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

Function replay_segment_lazy

nodedb-wal/src/lazy_reader.rs:178–187  ·  view source on GitHub ↗

Open a WAL segment for lazy reading and iterate with a callback. Convenience function for single-pass replay: the callback receives each header and decides whether to read or skip the payload.

(path: &Path, mut handler: F)

Source from the content-addressed store, hash-verified

176/// Convenience function for single-pass replay: the callback receives each
177/// header and decides whether to read or skip the payload.
178pub fn replay_segment_lazy<F>(path: &Path, mut handler: F) -> Result<()>
179where
180 F: FnMut(&mut LazyWalReader, &RecordHeader) -> Result<()>,
181{
182 let mut reader = LazyWalReader::open(path)?;
183 while let Some(header) = reader.next_header()? {
184 handler(&mut reader, &header)?;
185 }
186 Ok(())
187}
188
189/// Replay all WAL segments in a directory with lazy reading.
190///

Callers 1

replay_all_segments_lazyFunction · 0.85

Calls 2

next_headerMethod · 0.80
openFunction · 0.50

Tested by

no test coverage detected