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

Method from_bytes

nodedb-columnar/src/pk_index.rs:150–158  ·  view source on GitHub ↗

Deserialize the index from a checkpoint.

(data: &[u8])

Source from the content-addressed store, hash-verified

148
149 /// Deserialize the index from a checkpoint.
150 pub fn from_bytes(data: &[u8]) -> Result<Self, ColumnarError> {
151 let entries: Vec<(Vec<u8>, RowLocation)> =
152 zerompk::from_msgpack(data).map_err(|e| ColumnarError::Serialization(e.to_string()))?;
153 let mut inner = BTreeMap::new();
154 for (key, loc) in entries {
155 inner.insert(key, loc);
156 }
157 Ok(Self { inner })
158 }
159}
160
161impl Default for PkIndex {

Callers

nothing calls this directly

Calls 2

to_stringMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected