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

Method get_effect_receipts

atomic-core/src/pristine/txn/write/operation.rs:133–154  ·  view source on GitHub ↗
(&self, operation: OperationId)

Source from the content-addressed store, hash-verified

131 }
132
133 fn get_effect_receipts(&self, operation: OperationId) -> PristineResult<Vec<EffectReceipt>> {
134 if OperationTxnT::get_operation(self, operation)?.is_none() {
135 return Err(PristineError::OperationNotFound {
136 id: operation.to_string(),
137 });
138 }
139 let table = match self.txn.open_table(EFFECT_RECEIPTS) {
140 Ok(table) => table,
141 Err(redb::TableError::TableDoesNotExist(_)) => {
142 return Err(PristineError::OperationSchemaUnavailable);
143 }
144 Err(error) => return Err(error.into()),
145 };
146 let start = encode_effect_receipt_key(operation, EffectReceiptId::from_bytes([0; 32]));
147 let end = encode_effect_receipt_key(operation, EffectReceiptId::from_bytes([u8::MAX; 32]));
148 let mut receipts = Vec::new();
149 for entry in table.range::<&[u8; 64]>(&start..=&end)? {
150 let (key, value) = entry?;
151 receipts.push(decode_effect_receipt_row(key.value(), value.value())?);
152 }
153 Ok(receipts)
154 }
155}
156
157impl OperationMutTxnT for WriteTxn<'_> {

Callers 1

Calls 5

is_noneMethod · 0.80
valueMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected