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

Method insert_binding_bytes

atomic-core/src/pristine/txn/write/bindings.rs:29–43  ·  view source on GitHub ↗
(
        &mut self,
        id: &[u8; 32],
        bytes: &[u8],
    )

Source from the content-addressed store, hash-verified

27
28impl BindingMutTxnT for WriteTxn<'_> {
29 fn insert_binding_bytes(
30 &mut self,
31 id: &[u8; 32],
32 bytes: &[u8],
33 ) -> PristineResult<BindingStoreOutcome> {
34 let mut table = self.txn.open_table(BINDINGS)?;
35 if let Some(existing) = table.get(id)? {
36 if existing.value() == bytes {
37 return Ok(BindingStoreOutcome::Idempotent);
38 }
39 return Err(binding_conflict(&binding_id_hex(id)));
40 }
41 table.insert(id, bytes)?;
42 Ok(BindingStoreOutcome::Stored)
43 }
44}

Calls 5

binding_conflictFunction · 0.85
valueMethod · 0.80
binding_id_hexFunction · 0.70
getMethod · 0.65
insertMethod · 0.45