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

Method absorb_sparse

nodedb/src/engine/array/compaction/merger.rs:345–388  ·  view source on GitHub ↗
(&mut self, _schema: &ArraySchema, tile: &SparseTile)

Source from the content-addressed store, hash-verified

343 }
344
345 fn absorb_sparse(&mut self, _schema: &ArraySchema, tile: &SparseTile) -> ArrayResult<()> {
346 let n = tile.row_count();
347 for row in 0..n {
348 let coord: Vec<CoordValue> = tile
349 .dim_dicts
350 .iter()
351 .map(|d| d.values[d.indices[row] as usize].clone())
352 .collect();
353 let kind = tile.row_kind(row)?;
354 let (attrs, surrogate, valid_from_ms, valid_until_ms) = match kind {
355 RowKind::Live => {
356 let attrs: Vec<CellValue> =
357 tile.attr_cols.iter().map(|col| col[row].clone()).collect();
358 let surrogate = tile
359 .surrogates
360 .get(row)
361 .copied()
362 .unwrap_or(nodedb_types::Surrogate::ZERO);
363 let vf = tile.valid_from_ms.get(row).copied().unwrap_or(0);
364 let vu = tile
365 .valid_until_ms
366 .get(row)
367 .copied()
368 .unwrap_or(nodedb_types::OPEN_UPPER);
369 (attrs, surrogate, vf, vu)
370 }
371 RowKind::Tombstone | RowKind::GdprErased => (
372 Vec::new(),
373 nodedb_types::Surrogate::ZERO,
374 0,
375 nodedb_types::OPEN_UPPER,
376 ),
377 };
378 self.upsert(MergedRow {
379 coord,
380 attrs,
381 surrogate,
382 valid_from_ms,
383 valid_until_ms,
384 kind,
385 });
386 }
387 Ok(())
388 }
389
390 fn absorb_dense(&mut self, _schema: &ArraySchema, _tile: &DenseTile) -> ArrayResult<()> {
391 Err(nodedb_array::ArrayError::SegmentCorruption {

Callers 1

absorbMethod · 0.80

Calls 7

collectMethod · 0.80
row_kindMethod · 0.80
row_countMethod · 0.45
iterMethod · 0.45
cloneMethod · 0.45
getMethod · 0.45
upsertMethod · 0.45

Tested by

no test coverage detected