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