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

Method load_unhashed

atomic-repository/src/redb_change_store/queries.rs:226–241  ·  view source on GitHub ↗

Load the unhashed data for a change (if any). Returns `None` if no unhashed data is stored.

(&self, hash: &[u8; 32])

Source from the content-addressed store, hash-verified

224 ///
225 /// Returns `None` if no unhashed data is stored.
226 pub fn load_unhashed(&self, hash: &[u8; 32]) -> RedbStoreResult<Option<serde_json::Value>> {
227 let txn = self.db().begin_read()?;
228 let table = txn.open_table(tables::CHANGE_UNHASHED)?;
229
230 match table.get(hash)? {
231 Some(value) => {
232 let compressed = value.value();
233 let decompressed = zstd::decode_all(compressed).map_err(|e| {
234 RedbStoreError::Corrupt(format!("unhashed decompression failed: {}", e))
235 })?;
236 let json: serde_json::Value = serde_json::from_slice(&decompressed)?;
237 Ok(Some(json))
238 }
239 None => Ok(None),
240 }
241 }
242
243 // ── Statistics ──────────────────────────────────────────────────
244

Callers 2

test_unhashed_noneFunction · 0.80
test_unhashed_presentFunction · 0.80

Calls 2

dbMethod · 0.80
getMethod · 0.65

Tested by 2

test_unhashed_noneFunction · 0.64
test_unhashed_presentFunction · 0.64