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

Method install_flushed_segment

nodedb/src/engine/array/flush.rs:47–69  ·  view source on GitHub ↗
(
        &mut self,
        id: &ArrayId,
        prepared: PreparedFlush,
        flush_lsn: u64,
    )

Source from the content-addressed store, hash-verified

45 }
46
47 fn install_flushed_segment(
48 &mut self,
49 id: &ArrayId,
50 prepared: PreparedFlush,
51 flush_lsn: u64,
52 ) -> ArrayEngineResult<SegmentRef> {
53 let store = self.store_mut(id)?;
54 let path = store.root().join(&prepared.segment_id);
55 write_atomic(&path, &prepared.bytes).map_err(|e| ArrayEngineError::Io {
56 detail: format!("write segment {path:?}: {e}"),
57 })?;
58 let seg_ref = SegmentRef {
59 id: prepared.segment_id,
60 level: 0,
61 min_tile: prepared.min_tile.unwrap_or_else(|| TileId::snapshot(0)),
62 max_tile: prepared.max_tile.unwrap_or_else(|| TileId::snapshot(0)),
63 tile_count: prepared.tile_count,
64 flush_lsn,
65 };
66 store.install_segment(seg_ref.clone())?;
67 store.persist_manifest()?;
68 Ok(seg_ref)
69 }
70}
71
72struct PreparedFlush {

Callers 1

flushMethod · 0.80

Calls 8

snapshotFunction · 0.85
store_mutMethod · 0.80
joinMethod · 0.80
rootMethod · 0.80
install_segmentMethod · 0.80
persist_manifestMethod · 0.80
write_atomicFunction · 0.70
cloneMethod · 0.45

Tested by

no test coverage detected