Store a binding immutably (RFC §5.1). Identical bytes are an idempotent no-op; conflicting bytes under the same id are a hash collision or corruption and are refused.
(
&self,
binding: &GitStateBinding,
)
| 79 | /// Identical bytes are an idempotent no-op; conflicting bytes under the |
| 80 | /// same id are a hash collision or corruption and are refused. |
| 81 | pub fn store_binding( |
| 82 | &self, |
| 83 | binding: &GitStateBinding, |
| 84 | ) -> Result<BindingStoreOutcome, RepositoryError> { |
| 85 | let bytes = binding.encode(); |
| 86 | let id = *binding.id().as_bytes(); |
| 87 | let mut txn = self.pristine.write_txn().map_err(pristine_map)?; |
| 88 | let outcome = txn |
| 89 | .insert_binding_bytes(&id, &bytes) |
| 90 | .map_err(pristine_map)?; |
| 91 | use atomic_core::pristine::MutTxnT; |
| 92 | txn.commit().map_err(pristine_map)?; |
| 93 | Ok(outcome) |
| 94 | } |
| 95 | |
| 96 | /// Load a stored binding, fully revalidated. |
| 97 | /// |