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

Method get

nodedb/src/control/array_sync/snapshot_store.rs:154–164  ·  view source on GitHub ↗

Retrieve a snapshot by exact `(array, hlc)`.

(&self, array: &str, hlc: Hlc)

Source from the content-addressed store, hash-verified

152
153 /// Retrieve a snapshot by exact `(array, hlc)`.
154 pub fn get(&self, array: &str, hlc: Hlc) -> Option<TileSnapshot> {
155 let key = snapshot_key(array, hlc)?;
156 let txn = self.db.begin_read().ok()?;
157 let table = txn.open_table(SNAPSHOT_TABLE).ok()?;
158 let entry = table.get(key.as_slice()).ok()??;
159 decode_snapshot(entry.value())
160 .map_err(|e| {
161 warn!(array = %array, error = %e, "snapshot_store: decode error on get");
162 })
163 .ok()
164 }
165
166 /// Return the snapshot with the highest HLC for `array`, or `None` if none exist.
167 pub fn latest_for_array(&self, array: &str) -> Option<TileSnapshot> {

Callers 15

min_ack_hlcMethod · 0.45
ack_vectorMethod · 0.45
all_replicasMethod · 0.45
propose_and_awaitMethod · 0.45
schema_hlcMethod · 0.45
tile_extentsMethod · 0.45
to_array_schemaMethod · 0.45
export_snapshotMethod · 0.45
handle_schemaMethod · 0.45
apply_opMethod · 0.45
appendMethod · 0.45
put_and_get_roundtripFunction · 0.45

Calls 4

snapshot_keyFunction · 0.85
decode_snapshotFunction · 0.85
okMethod · 0.45
as_sliceMethod · 0.45

Tested by 1

put_and_get_roundtripFunction · 0.36