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

Method load_meta

atomic-repository/src/redb_change_store/mod.rs:410–428  ·  view source on GitHub ↗

Load the metadata for a change. This reads only from CHANGE_META — the cheapest possible read. Useful for `atomic log`, header inspection, dependency resolution.

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

Source from the content-addressed store, hash-verified

408 /// This reads only from CHANGE_META — the cheapest possible read.
409 /// Useful for `atomic log`, header inspection, dependency resolution.
410 pub fn load_meta(&self, hash: &[u8; 32]) -> RedbStoreResult<StoredChangeMeta> {
411 let txn = self.db.begin_read()?;
412 let table = txn.open_table(tables::CHANGE_META)?;
413
414 let value = table.get(hash)?.ok_or_else(|| RedbStoreError::NotFound {
415 hash: format!(
416 "{:02x}{:02x}{:02x}{:02x}…",
417 hash[0], hash[1], hash[2], hash[3]
418 ),
419 })?;
420
421 let compressed = value.value();
422 let decompressed = zstd::decode_all(compressed)
423 .map_err(|e| RedbStoreError::Corrupt(format!("meta decompression failed: {}", e)))?;
424 let meta: StoredChangeMeta = postcard::from_bytes(&decompressed)
425 .map_err(|e| RedbStoreError::Corrupt(format!("meta deserialization failed: {}", e)))?;
426
427 Ok(meta)
428 }
429
430 // NOTE: load_change(), export_v3_file(), export_v3_bytes(), and
431 // delete_change() are in queries.rs

Callers 11

needs_semantic_regenFunction · 0.80
load_graph_sectionsMethod · 0.80
load_content_chunksMethod · 0.80
get_chunk_manifestMethod · 0.80
delete_changeMethod · 0.80
export_v3_bytesMethod · 0.80
test_save_and_load_metaFunction · 0.80
test_load_meta_not_foundFunction · 0.80
test_load_graph_sectionsFunction · 0.80

Calls 1

getMethod · 0.65

Tested by 4

test_save_and_load_metaFunction · 0.64
test_load_meta_not_foundFunction · 0.64
test_load_graph_sectionsFunction · 0.64