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

Method pages_to_flush

nodedb/src/storage/checkpoint.rs:66–75  ·  view source on GitHub ↗

Compute how many pages to flush this tick.

(&self, config: &CheckpointConfig)

Source from the content-addressed store, hash-verified

64
65 /// Compute how many pages to flush this tick.
66 pub fn pages_to_flush(&self, config: &CheckpointConfig) -> usize {
67 if self.dirty_pages >= config.force_flush_threshold {
68 // Over threshold: flush everything to prevent stalling.
69 self.dirty_pages
70 } else {
71 // Normal: flush a fraction.
72 let target = (self.dirty_pages as f64 * config.flush_fraction).ceil() as usize;
73 target.max(1).min(self.dirty_pages)
74 }
75 }
76
77 /// Record that pages were flushed.
78 pub fn record_flush(&mut self, count: usize) {

Callers 1

tickMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected