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

Method from_changelist

atomic-remote/src/sync.rs:151–160  ·  view source on GitHub ↗

Build a cache from a list of changelist entries. This is used to seed the cache from a full changelist download (e.g., on the first sync).

(entries: &[ChangelistEntry])

Source from the content-addressed store, hash-verified

149 /// This is used to seed the cache from a full changelist download
150 /// (e.g., on the first sync).
151 pub fn from_changelist(entries: &[ChangelistEntry]) -> Self {
152 let mut cache = Self::empty();
153 for entry in entries {
154 let node = entry.to_node();
155 cache.entries.insert(entry.sequence, node);
156 cache.last_sequence = Some(entry.sequence);
157 cache.last_state = Some(entry.merkle.clone());
158 }
159 cache
160 }
161
162 /// Get the cached node at a given sequence number.
163 pub fn get(&self, sequence: u64) -> Option<&Node> {

Callers

nothing calls this directly

Calls 3

to_nodeMethod · 0.80
insertMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected