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

Function drain_for_partition

nodedb/src/engine/timeseries/o3_buffer.rs:164–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

162
163 #[test]
164 fn drain_for_partition() {
165 let mut buf = O3Buffer::new(100);
166 buf.insert(make_row(100, 1, 0));
167 buf.insert(make_row(200, 1, 86_400_000));
168 buf.insert(make_row(300, 2, 0));
169 assert_eq!(buf.len(), 3);
170
171 let drained = buf.drain_for_partition(0);
172 assert_eq!(drained.len(), 2);
173 assert_eq!(buf.len(), 1);
174 // Drained should be sorted by timestamp.
175 assert_eq!(drained[0].timestamp_ms, 100);
176 assert_eq!(drained[1].timestamp_ms, 300);
177 }
178
179 #[test]
180 fn dedup_last_write_wins() {

Callers

nothing calls this directly

Calls 3

drain_for_partitionMethod · 0.80
make_rowFunction · 0.70
insertMethod · 0.45

Tested by

no test coverage detected