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

Method new

atomic-core/src/pristine/vault.rs:126–142  ·  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

124impl VaultEntry {
125 /// Create a new vault entry. Computes the content hash automatically.
126 pub fn new(
127 entry_type: VaultEntryType,
128 content: Vec<u8>,
129 frontmatter_json: String,
130 now: String,
131 ) -> Self {
132 let content_hash = blake3::hash(&content);
133 Self {
134 entry_type,
135 content_hash: *content_hash.as_bytes(),
136 content_bytes: content,
137 frontmatter_json,
138 created_at: now.clone(),
139 updated_at: now,
140 introduced_by: 0,
141 }
142 }
143
144 /// Size in bytes (content only, not metadata).
145 pub fn content_size(&self) -> usize {

Callers

nothing calls this directly

Calls 3

hashFunction · 0.70
as_bytesMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected