MCPcopy Create free account
hub / github.com/aws/clock-bound / expunge_old

Method expunge_old

clock-bound/src/daemon/clock_sync_algorithm/ring_buffer.rs:162–175  ·  view source on GitHub ↗

Purge undesired values Removes values from the buffers that: - Are before a certain TSC - are greater than a specified rtt

(&mut self, before: TscCount)

Source from the content-addressed store, hash-verified

160 /// - Are before a certain TSC
161 /// - are greater than a specified rtt
162 pub fn expunge_old(&mut self, before: TscCount) {
163 self.buffer.retain(|event| {
164 // Now, I would normally like to NOT have any logging in a low level function like this
165 // But I don't have a way of returning the dropped values without allocating.
166 //
167 // Logging at a debug level
168 if event.tsc_post() >= before {
169 true
170 } else {
171 tracing::debug!(?event, "Purging stale event");
172 false
173 }
174 });
175 }
176}
177
178/// Specify the quarter in [`RingBuffer::min_rtt_in_quarter`] to use

Callers 3

purge_earlier_thanFunction · 0.80
empty_buffer_operationsFunction · 0.80
expunge_old_eventsMethod · 0.80

Calls 1

tsc_postMethod · 0.45

Tested by 2

purge_earlier_thanFunction · 0.64
empty_buffer_operationsFunction · 0.64