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

Method drain_for_partition

nodedb/src/engine/timeseries/o3_buffer.rs:67–79  ·  view source on GitHub ↗

Drain all rows targeting a specific partition (for merge). Returns the drained rows sorted by timestamp. Removes them from the buffer.

(&mut self, partition_start: i64)

Source from the content-addressed store, hash-verified

65 ///
66 /// Returns the drained rows sorted by timestamp. Removes them from the buffer.
67 pub fn drain_for_partition(&mut self, partition_start: i64) -> Vec<O3Row> {
68 let mut drained = Vec::new();
69 self.rows.retain(|r| {
70 if r.target_partition_start == partition_start {
71 drained.push(r.clone());
72 false
73 } else {
74 true
75 }
76 });
77 drained.sort_by_key(|r| r.timestamp_ms);
78 drained
79 }
80
81 /// Dedup by (series_id, timestamp) — last-write-wins.
82 ///

Callers 1

drain_for_partitionFunction · 0.80

Calls 2

pushMethod · 0.45
cloneMethod · 0.45

Tested by 1

drain_for_partitionFunction · 0.64