Remove a segment from the index.
(&mut self, series_id: SeriesId, min_ts: i64)
| 60 | |
| 61 | /// Remove a segment from the index. |
| 62 | pub fn remove(&mut self, series_id: SeriesId, min_ts: i64) -> Option<SegmentRef> { |
| 63 | let tree = self.entries.get_mut(&series_id)?; |
| 64 | let seg = tree.remove(&min_ts)?; |
| 65 | self.total_bytes = self.total_bytes.saturating_sub(seg.size_bytes); |
| 66 | self.total_segments = self.total_segments.saturating_sub(1); |
| 67 | if tree.is_empty() { |
| 68 | self.entries.remove(&series_id); |
| 69 | } |
| 70 | Some(seg) |
| 71 | } |
| 72 | |
| 73 | pub fn series_count(&self) -> usize { |
| 74 | self.entries.len() |
no test coverage detected