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

Function build_segment_bytes

nodedb/src/engine/array/compaction/merger.rs:295–312  ·  view source on GitHub ↗
(
    schema: &ArraySchema,
    schema_hash: u64,
    kek: Option<&nodedb_wal::crypto::WalEncryptionKey>,
    tiles: impl Iterator<Item = (TileId, MergedTile)>,
)

Source from the content-addressed store, hash-verified

293}
294
295fn build_segment_bytes(
296 schema: &ArraySchema,
297 schema_hash: u64,
298 kek: Option<&nodedb_wal::crypto::WalEncryptionKey>,
299 tiles: impl Iterator<Item = (TileId, MergedTile)>,
300) -> ArrayResult<Vec<u8>> {
301 let mut writer = SegmentWriter::new(schema_hash);
302 for (tile_id, mt) in tiles {
303 let tile = mt.into_sparse(schema)?;
304 // Skip tiles that have neither live rows nor sentinel rows.
305 let has_any_rows = tile.nnz() > 0 || !tile.row_kinds.is_empty();
306 if !has_any_rows {
307 continue;
308 }
309 writer.append_sparse(tile_id, &tile)?;
310 }
311 writer.finish(kek)
312}
313
314/// Row record inside a [`MergedTile`] accumulator.
315struct MergedRow {

Callers 1

runMethod · 0.85

Calls 5

into_sparseMethod · 0.80
append_sparseMethod · 0.80
nnzMethod · 0.45
is_emptyMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected