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

Method get_operation_heads

atomic-core/src/pristine/txn/write/operation.rs:81–104  ·  view source on GitHub ↗
(&self, scope: OperationScope)

Source from the content-addressed store, hash-verified

79 }
80
81 fn get_operation_heads(&self, scope: OperationScope) -> PristineResult<OperationHeads> {
82 let table = match self.txn.open_table(OP_HEADS) {
83 Ok(table) => table,
84 Err(redb::TableError::TableDoesNotExist(_)) => {
85 return Err(PristineError::OperationSchemaUnavailable);
86 }
87 Err(error) => return Err(error.into()),
88 };
89 let key = encode_operation_scope(scope);
90 let heads = match table.get(&key)? {
91 Some(value) => {
92 decode_operation_heads(value.value()).map_err(operation_serialization_error)?
93 }
94 None => OperationHeads::new(Vec::new()),
95 };
96 for head in heads.as_slice() {
97 if OperationTxnT::get_operation(self, *head)?.is_none() {
98 return Err(PristineError::OperationNotFound {
99 id: head.to_string(),
100 });
101 }
102 }
103 Ok(heads)
104 }
105
106 fn list_operation_heads(&self) -> PristineResult<Vec<(OperationScope, OperationHeads)>> {
107 let table = match self.txn.open_table(OP_HEADS) {

Callers 1

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

Tested by

no test coverage detected