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

Function vault_entry_revision_hash

libatomic/src/daemon/services_agent.rs:316–327  ·  view source on GitHub ↗

Identify the exact stored Vault revision (entry type, frontmatter, and body — not only the body content hash).

(entry: &VaultEntry)

Source from the content-addressed store, hash-verified

314 /// Identify the exact stored Vault revision (entry type, frontmatter,
315 /// and body — not only the body content hash).
316 fn vault_entry_revision_hash(entry: &VaultEntry) -> String {
317 fn append_revision_field(hasher: &mut Hasher, value: &[u8]) {
318 hasher.update(&(value.len() as u64).to_be_bytes());
319 hasher.update(value);
320 }
321 let mut hasher = Hasher::new();
322 hasher.update(b"atomic-vault-revision-v1");
323 append_revision_field(&mut hasher, entry.entry_type.as_str().as_bytes());
324 append_revision_field(&mut hasher, entry.frontmatter_json.as_bytes());
325 append_revision_field(&mut hasher, &entry.content_bytes);
326 hasher.finalize().to_base32()
327 }
328
329 /// Truncate to at most `max_chars` characters on a char boundary.
330 fn truncate_chars(value: &str, max_chars: usize) -> String {

Callers 1

resolve_and_rankFunction · 0.70

Calls 6

append_revision_fieldFunction · 0.70
updateMethod · 0.45
as_bytesMethod · 0.45
as_strMethod · 0.45
to_base32Method · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected