op_heads_store: don't pass whole RepoLoader into get_heads()

We only need to be able to read operations, so it's better to pass in
just an `OpStore`.
This commit is contained in:
Martin von Zweigbergk 2022-04-20 17:08:03 -07:00 committed by Martin von Zweigbergk
parent 21d8c501e3
commit 601638c422
2 changed files with 2 additions and 5 deletions

View file

@ -23,7 +23,6 @@ use crate::backend::Timestamp;
use crate::lock::FileLock;
use crate::op_store::{OpStore, OperationId, OperationMetadata};
use crate::operation::Operation;
use crate::repo::RepoLoader;
use crate::{dag_walk, op_store};
/// Manages the very set of current heads of the operation log. The store is
@ -124,7 +123,7 @@ impl OpHeadsStore {
pub fn get_heads(
self: &Arc<Self>,
repo_loader: &RepoLoader,
op_store: &Arc<dyn OpStore>,
) -> Result<OpHeads, OpHeadResolutionError> {
let mut op_heads = self.get_op_heads();
@ -132,8 +131,6 @@ impl OpHeadsStore {
return Err(OpHeadResolutionError::NoHeads);
}
let op_store = repo_loader.op_store();
if op_heads.len() == 1 {
let operation_id = op_heads.pop().unwrap();
let operation = op_store.read_operation(&operation_id).unwrap();

View file

@ -373,7 +373,7 @@ impl RepoLoader {
}
pub fn load_at_head(&self) -> RepoAtHead {
let op_heads = self.op_heads_store.get_heads(self).unwrap();
let op_heads = self.op_heads_store.get_heads(&self.op_store).unwrap();
match op_heads {
OpHeads::Single(op) => {
let view = View::new(op.view().take_store_view());