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

Function replay_from_checkpoint_lsn

nodedb-wal/src/segmented.rs:474–490  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

472
473 #[test]
474 fn replay_from_checkpoint_lsn() {
475 let dir = tempfile::tempdir().unwrap();
476 let wal_dir = dir.path().join("wal");
477
478 let mut wal = SegmentedWal::open(test_config(&wal_dir)).unwrap();
479 for i in 0..10u32 {
480 wal.append(RecordType::Put as u32, 1, 0, 0, format!("r{i}").as_bytes())
481 .unwrap();
482 }
483 wal.sync().unwrap();
484
485 // Replay from LSN 6 — should return LSNs 6..=10.
486 let records = wal.replay_from(6).unwrap();
487 assert_eq!(records.len(), 5);
488 assert_eq!(records[0].header.lsn, 6);
489 assert_eq!(records[4].header.lsn, 10);
490 }
491
492 #[test]
493 fn total_size_bytes() {

Callers

nothing calls this directly

Calls 8

joinMethod · 0.80
test_configFunction · 0.70
openFunction · 0.50
pathMethod · 0.45
appendMethod · 0.45
as_bytesMethod · 0.45
syncMethod · 0.45
replay_fromMethod · 0.45

Tested by

no test coverage detected