| 714 | } |
| 715 | |
| 716 | fn get_effect_receipts(&self, operation: OperationId) -> PristineResult<Vec<EffectReceipt>> { |
| 717 | if OperationTxnT::get_operation(self, operation)?.is_none() { |
| 718 | return Err(PristineError::OperationNotFound { |
| 719 | id: operation.to_string(), |
| 720 | }); |
| 721 | } |
| 722 | let table = match self.txn.open_table(EFFECT_RECEIPTS) { |
| 723 | Ok(table) => table, |
| 724 | Err(redb::TableError::TableDoesNotExist(_)) => { |
| 725 | return Err(PristineError::OperationSchemaUnavailable); |
| 726 | } |
| 727 | Err(error) => return Err(error.into()), |
| 728 | }; |
| 729 | let start = encode_effect_receipt_key(operation, EffectReceiptId::from_bytes([0; 32])); |
| 730 | let end = encode_effect_receipt_key(operation, EffectReceiptId::from_bytes([u8::MAX; 32])); |
| 731 | let mut receipts = Vec::new(); |
| 732 | for entry in table.range::<&[u8; 64]>(&start..=&end)? { |
| 733 | let (key, value) = entry?; |
| 734 | receipts.push(decode_effect_receipt_row(key.value(), value.value())?); |
| 735 | } |
| 736 | Ok(receipts) |
| 737 | } |
| 738 | } |
| 739 | |
| 740 | // WorkingCopyTxnT Implementation |