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

Method new

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

99impl VaultEntry {
100 /// Create a new vault entry. Computes the content hash automatically.
101 pub fn new(
102 entry_type: VaultEntryType,
103 content: Vec<u8>,
104 frontmatter_json: String,
105 now: String,
106 ) -> Self {
107 let content_hash = blake3::hash(&content);
108 Self {
109 entry_type,
110 content_hash: *content_hash.as_bytes(),
111 content_bytes: content,
112 frontmatter_json,
113 created_at: now.clone(),
114 updated_at: now,
115 introduced_by: 0,
116 }
117 }
118
119 /// Size in bytes (content only, not metadata).
120 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