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

Method should_flush

nodedb/src/control/surrogate/registry.rs:135–143  ·  view source on GitHub ↗

True if the periodic-flush thresholds (ops or elapsed) are tripped.

(&self)

Source from the content-addressed store, hash-verified

133
134 /// True if the periodic-flush thresholds (ops or elapsed) are tripped.
135 pub fn should_flush(&self) -> bool {
136 if self.allocs_since_flush.load(Ordering::Acquire) >= FLUSH_OPS_THRESHOLD {
137 return true;
138 }
139 if let Ok(last) = self.last_flush_at.lock() {
140 return last.elapsed() >= FLUSH_ELAPSED_THRESHOLD;
141 }
142 false
143 }
144
145 /// Idempotently raise the high-watermark to at least `new_hwm`.
146 /// Used by WAL replay: each replayed `SurrogateAlloc` record advances

Callers 5

assignMethod · 0.45
assign_anonymousMethod · 0.45
handle_create_databaseFunction · 0.45
handle_clone_databaseFunction · 0.45
handle_mirror_databaseFunction · 0.45

Calls 3

lockMethod · 0.80
elapsedMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected