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

Method get_operation_heads

atomic-core/src/pristine/txn/read.rs:664–687  ·  view source on GitHub ↗
(&self, scope: OperationScope)

Source from the content-addressed store, hash-verified

662 }
663
664 fn get_operation_heads(&self, scope: OperationScope) -> PristineResult<OperationHeads> {
665 let table = match self.txn.open_table(OP_HEADS) {
666 Ok(table) => table,
667 Err(redb::TableError::TableDoesNotExist(_)) => {
668 return Err(PristineError::OperationSchemaUnavailable);
669 }
670 Err(error) => return Err(error.into()),
671 };
672 let key = crate::operation::encode_operation_scope(scope);
673 let heads = match table.get(&key)? {
674 Some(value) => {
675 decode_operation_heads(value.value()).map_err(operation_serialization_error)?
676 }
677 None => OperationHeads::new(Vec::new()),
678 };
679 for head in heads.as_slice() {
680 if OperationTxnT::get_operation(self, *head)?.is_none() {
681 return Err(PristineError::OperationNotFound {
682 id: head.to_string(),
683 });
684 }
685 }
686 Ok(heads)
687 }
688
689 fn list_operation_heads(&self) -> PristineResult<Vec<(OperationScope, OperationHeads)>> {
690 let table = match self.txn.open_table(OP_HEADS) {

Calls 6

encode_operation_scopeFunction · 0.85
decode_operation_headsFunction · 0.85
valueMethod · 0.80
is_noneMethod · 0.80
getMethod · 0.65
as_sliceMethod · 0.45