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

Method compact

nodedb-vector/src/sieve/workload.rs:117–120  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Calls

no outgoing calls