Drop all log entries older than `retention_secs` seconds before `now`. Entries with `timestamp_secs < now - retention_secs` are removed. Entries at or after that boundary are kept.
(&mut self, now_secs: u64, retention_secs: u64)
| 115 | /// Entries with `timestamp_secs < now - retention_secs` are removed. |
| 116 | /// Entries at or after that boundary are kept. |
| 117 | pub fn compact(&mut self, now_secs: u64, retention_secs: u64) { |
| 118 | let cutoff = now_secs.saturating_sub(retention_secs); |
| 119 | self.log.retain(|r| r.timestamp_secs >= cutoff); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | #[cfg(test)] |
no outgoing calls