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

Function mint_view_snapshot

libatomic/src/daemon/services_sync_remote.rs:348–373  ·  view source on GitHub ↗

The local `mint_view_snapshot` — the content-addressed snapshot mint (the own-set-id fold matches the server bridge).

(manifest: &ViewManifest, prev: Option<String>)

Source from the content-addressed store, hash-verified

346/// The local `mint_view_snapshot` — the content-addressed snapshot mint
347/// (the own-set-id fold matches the server bridge).
348fn mint_view_snapshot(manifest: &ViewManifest, prev: Option<String>) -> ViewSnapshot {
349 let own_changes: Vec<String> = manifest.changes.iter().map(|h| h.to_base32()).collect();
350 let mut acc = SetId::ZERO;
351 for hash in &manifest.changes {
352 acc = acc.add(hash);
353 }
354 let own_set_id = acc.to_base32();
355 let merkle_state = if manifest.changes.is_empty() {
356 None
357 } else {
358 Some(manifest.state.to_base32())
359 };
360 let scope = if manifest.scope.is_draft() {
361 ViewScopeLabel::Draft
362 } else {
363 ViewScopeLabel::Shared
364 };
365 ViewSnapshot::new(
366 scope,
367 manifest.parent.clone(),
368 prev.into_iter().collect(),
369 own_changes,
370 own_set_id,
371 merkle_state,
372 )
373}
374
375/// The local `load_change_data` — the raw on-disk change bytes (the exact
376/// bytes that produced the content hash), with the load+serialize fallback.

Callers 1

push_changes_implFunction · 0.70

Calls 8

collectMethod · 0.45
iterMethod · 0.45
to_base32Method · 0.45
addMethod · 0.45
is_emptyMethod · 0.45
is_draftMethod · 0.45
cloneMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected