MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / encode_snapshot

Function encode_snapshot

nodedb-array/src/sync/snapshot.rs:129–133  ·  view source on GitHub ↗

Encode a [`TileSnapshot`] to MessagePack bytes. Use [`decode_snapshot`] to reverse. Errors map to [`ArrayError::SegmentCorruption`].

(s: &TileSnapshot)

Source from the content-addressed store, hash-verified

127/// Use [`decode_snapshot`] to reverse. Errors map to
128/// [`ArrayError::SegmentCorruption`].
129pub fn encode_snapshot(s: &TileSnapshot) -> ArrayResult<Vec<u8>> {
130 zerompk::to_msgpack_vec(s).map_err(|e| ArrayError::SegmentCorruption {
131 detail: format!("snapshot encode failed: {e}"),
132 })
133}
134
135/// Decode a [`TileSnapshot`] from MessagePack bytes produced by [`encode_snapshot`].
136///

Callers 2

putMethod · 0.85
tile_snapshot_roundtripFunction · 0.85

Calls

no outgoing calls

Tested by 1

tile_snapshot_roundtripFunction · 0.68