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

Method drain

nodedb-columnar/src/memtable/mod.rs:157–169  ·  view source on GitHub ↗

Drain the memtable: return all column data and reset to empty.

(&mut self)

Source from the content-addressed store, hash-verified

155
156 /// Drain the memtable: return all column data and reset to empty.
157 pub fn drain(&mut self) -> (ColumnarSchema, Vec<ColumnData>, usize) {
158 let columns = std::mem::replace(
159 &mut self.columns,
160 self.schema
161 .columns
162 .iter()
163 .map(|col| ColumnData::new(&col.column_type, col.nullable))
164 .collect(),
165 );
166 let row_count = self.row_count;
167 self.row_count = 0;
168 (self.schema.clone(), columns, row_count)
169 }
170
171 /// Drain with automatic dictionary encoding for low-cardinality String columns.
172 pub fn drain_optimized(&mut self) -> (ColumnarSchema, Vec<ColumnData>, usize) {

Calls 3

collectMethod · 0.80
iterMethod · 0.45
cloneMethod · 0.45