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)
| 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 | /// |