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

Method bulk_insert

nodedb-columnar/src/pk_index.rs:122–135  ·  view source on GitHub ↗

Bulk insert entries for a newly flushed segment. `pk_bytes_list` contains the encoded PK bytes for each row in the segment (in order). `segment_id` is the new segment's ID.

(
        &mut self,
        segment_id: u64,
        pk_bytes_list: &[Vec<u8>],
    )

Source from the content-addressed store, hash-verified

120 /// `pk_bytes_list` contains the encoded PK bytes for each row in the segment
121 /// (in order). `segment_id` is the new segment's ID.
122 pub fn bulk_insert(
123 &mut self,
124 segment_id: u64,
125 pk_bytes_list: &[Vec<u8>],
126 ) -> Result<(), ColumnarError> {
127 for (row_index, pk_bytes) in pk_bytes_list.iter().enumerate() {
128 let location = RowLocation {
129 segment_id,
130 row_index: row_index as u32,
131 };
132 self.insert(pk_bytes.clone(), location)?;
133 }
134 Ok(())
135 }
136
137 /// Remove all entries pointing to a given segment (used when dropping a segment).
138 pub fn remove_segment(&mut self, segment_id: u64) {

Callers 4

bulk_insertFunction · 0.80
remap_segmentFunction · 0.80
remove_segmentFunction · 0.80
serialization_roundtripFunction · 0.80

Calls 3

iterMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45

Tested by 4

bulk_insertFunction · 0.64
remap_segmentFunction · 0.64
remove_segmentFunction · 0.64
serialization_roundtripFunction · 0.64