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

Method new

atomic-core/src/pristine/vault.rs:93–109  ·  view source on GitHub ↗

Create a new vault entry. Computes the content hash automatically.

(
        entry_type: VaultEntryType,
        content: Vec<u8>,
        frontmatter_json: String,
        now: String,
    )

Source from the content-addressed store, hash-verified

91impl VaultEntry {
92 /// Create a new vault entry. Computes the content hash automatically.
93 pub fn new(
94 entry_type: VaultEntryType,
95 content: Vec<u8>,
96 frontmatter_json: String,
97 now: String,
98 ) -> Self {
99 let content_hash = blake3::hash(&content);
100 Self {
101 entry_type,
102 content_hash: *content_hash.as_bytes(),
103 content_bytes: content,
104 frontmatter_json,
105 created_at: now.clone(),
106 updated_at: now,
107 introduced_by: 0,
108 }
109 }
110
111 /// Size in bytes (content only, not metadata).
112 pub fn content_size(&self) -> usize {

Callers

nothing calls this directly

Calls 3

hashFunction · 0.85
as_bytesMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected