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

Method store_binding

atomic-repository/src/repository/binding_store.rs:81–94  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

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 ///

Calls 6

write_txnMethod · 0.80
insert_binding_bytesMethod · 0.80
encodeMethod · 0.45
as_bytesMethod · 0.45
idMethod · 0.45
commitMethod · 0.45