Skip to content

Commit

Permalink
op_heads_store: remove Result that never fails (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvonz committed Mar 23, 2022
1 parent 14c3ff4 commit 5feebe6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/src/op_heads_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl OpHeadsStore {
return Ok(op_heads.pop().unwrap());
}

let merged_repo = merge_op_heads(repo_loader, op_heads)?.leave_unpublished();
let merged_repo = merge_op_heads(repo_loader, op_heads).leave_unpublished();
let merge_operation = merged_repo.operation().clone();
locked_op_heads.finish(&merge_operation);
// TODO: Change the return type include the repo if we have it (as we do here)
Expand All @@ -190,10 +190,7 @@ impl OpHeadsStore {
}
}

fn merge_op_heads(
repo_loader: &RepoLoader,
mut op_heads: Vec<Operation>,
) -> Result<UnpublishedOperation, OpHeadResolutionError> {
fn merge_op_heads(repo_loader: &RepoLoader, mut op_heads: Vec<Operation>) -> UnpublishedOperation {
op_heads.sort_by_key(|op| op.store_operation().metadata.end_time.timestamp.clone());
let base_repo = repo_loader.load_at(&op_heads[0]);
let mut tx = base_repo.start_transaction("resolve concurrent operations");
Expand All @@ -216,5 +213,5 @@ fn merge_op_heads(
// TODO: We already have the resulting View in this case but Operation cannot
// keep it. Teach Operation to have a cached View so the caller won't have
// to re-read it from the store (by calling Operation::view())?
Ok(tx.write())
tx.write()
}

0 comments on commit 5feebe6

Please sign in to comment.