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

Function build_segment

nodedb-array/src/query/retention.rs:357–363  ·  view source on GitHub ↗

Write a segment with the given (TileId, SparseTile) pairs (must be strictly ascending by TileId) and return the in-memory bytes.

(pairs: Vec<(TileId, SparseTile)>)

Source from the content-addressed store, hash-verified

355 /// Write a segment with the given (TileId, SparseTile) pairs (must be
356 /// strictly ascending by TileId) and return the in-memory bytes.
357 fn build_segment(pairs: Vec<(TileId, SparseTile)>) -> Vec<u8> {
358 let mut w = SegmentWriter::new(0xBEEF);
359 for (id, tile) in pairs {
360 w.append_sparse(id, &tile).unwrap();
361 }
362 w.finish(None).unwrap()
363 }
364
365 /// Build a single-row Live SparseTile at coord `x` with value `v`.
366 fn live_tile(schema: &ArraySchema, x: i64, v: i64) -> SparseTile {

Calls 2

append_sparseMethod · 0.80
finishMethod · 0.45