MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / sole_operation_head

Method sole_operation_head

atomic-repository/src/repository/operation.rs:1163–1179  ·  view source on GitHub ↗
(
        &self,
        scope: OperationScope,
    )

Source from the content-addressed store, hash-verified

1161 }
1162
1163 pub(super) fn sole_operation_head(
1164 &self,
1165 scope: OperationScope,
1166 ) -> Result<OperationId, RepositoryError> {
1167 let txn = self.pristine.read_txn().map_err(pristine_error)?;
1168 let heads = txn.get_operation_heads(scope).map_err(pristine_error)?;
1169 match heads.as_slice() {
1170 [head] => Ok(*head),
1171 [] => Err(RepositoryError::OperationNotFound {
1172 selector: format!("current head of {scope}"),
1173 }),
1174 many => Err(RepositoryError::OperationHeadsDiverged {
1175 scope: scope.to_string(),
1176 heads: many.iter().map(ToString::to_string).collect(),
1177 }),
1178 }
1179 }
1180
1181 /// Return operations reachable from a scope's heads in deterministic causal order.
1182 ///

Calls 5

read_txnMethod · 0.80
get_operation_headsMethod · 0.45
as_sliceMethod · 0.45
collectMethod · 0.45
iterMethod · 0.45