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

Function encode_blob_vec

nodedb-cluster/src/distributed_array/partition.rs:133–139  ·  view source on GitHub ↗

Encode a `Vec >` (collection of opaque blobs) as a zerompk array. Each blob is emitted as raw msgpack bytes (already encoded by the caller) wrapped in a msgpack bin or str value. We re-encode the entire collection as a msgpack array of byte-arrays so the shard handler can deserialise it as `Vec ` and forward to the engine.

(blobs: &[Vec<u8>])

Source from the content-addressed store, hash-verified

131/// as a msgpack array of byte-arrays so the shard handler can deserialise it
132/// as `Vec<raw-bytes>` and forward to the engine.
133fn encode_blob_vec(blobs: &[Vec<u8>]) -> Result<Vec<u8>> {
134 // zerompk::to_msgpack_vec requires Sized, so pass as a Vec reference.
135 let owned: Vec<Vec<u8>> = blobs.to_vec();
136 zerompk::to_msgpack_vec(&owned).map_err(|e| ClusterError::Codec {
137 detail: format!("partition encode blob vec: {e}"),
138 })
139}
140
141#[cfg(test)]
142mod tests {

Callers 2

partition_put_cellsFunction · 0.85
partition_delete_coordsFunction · 0.85

Calls 1

to_vecMethod · 0.45

Tested by

no test coverage detected