(&self, scope: OperationScope)
| 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) { |
no test coverage detected