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

Function reopen_continues_lsn

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

Source from the content-addressed store, hash-verified

505
506 #[test]
507 fn reopen_continues_lsn() {
508 let dir = tempfile::tempdir().unwrap();
509 let wal_dir = dir.path().join("wal");
510
511 {
512 let mut wal = SegmentedWal::open(test_config(&wal_dir)).unwrap();
513 wal.append(RecordType::Put as u32, 1, 0, 0, b"a").unwrap();
514 wal.append(RecordType::Put as u32, 1, 0, 0, b"b").unwrap();
515 wal.sync().unwrap();
516 }
517
518 {
519 let mut wal = SegmentedWal::open(test_config(&wal_dir)).unwrap();
520 assert_eq!(wal.next_lsn(), 3);
521 let lsn = wal.append(RecordType::Put as u32, 1, 0, 0, b"c").unwrap();
522 assert_eq!(lsn, 3);
523 wal.sync().unwrap();
524 }
525
526 let wal = SegmentedWal::open(test_config(&wal_dir)).unwrap();
527 let records = wal.replay().unwrap();
528 assert_eq!(records.len(), 3);
529 }
530
531 #[test]
532 fn encryption_persists_across_segments() {

Callers

nothing calls this directly

Calls 7

joinMethod · 0.80
test_configFunction · 0.70
openFunction · 0.50
pathMethod · 0.45
appendMethod · 0.45
syncMethod · 0.45
replayMethod · 0.45

Tested by

no test coverage detected