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

Method load_binding

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

Load a stored binding, fully revalidated. Malformed stored bytes fail closed: bindings are immutable facts, and silently returning `None` for corrupt data would hide tampering.

(&self, id: &BindingId)

Source from the content-addressed store, hash-verified

98 /// Malformed stored bytes fail closed: bindings are immutable facts, and
99 /// silently returning `None` for corrupt data would hide tampering.
100 pub fn load_binding(&self, id: &BindingId) -> Result<Option<GitStateBinding>, RepositoryError> {
101 let txn = self.pristine.read_txn().map_err(pristine_map)?;
102 let bytes = txn.get_binding_bytes(id.as_bytes()).map_err(pristine_map)?;
103 match bytes {
104 None => Ok(None),
105 Some(bytes) => GitStateBinding::decode(&bytes).map(Some).map_err(|error| {
106 RepositoryError::InvalidOperation {
107 message: format!(
108 "stored binding {} failed revalidation: {error}",
109 id.to_hex()
110 ),
111 }
112 }),
113 }
114 }
115
116 /// Every stored binding id in deterministic order.
117 pub fn binding_ids(&self) -> Result<Vec<BindingId>, RepositoryError> {

Calls 4

read_txnMethod · 0.80
decodeFunction · 0.70
get_binding_bytesMethod · 0.45
as_bytesMethod · 0.45