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

Function lsn_increments

nodedb-wal/src/writer.rs:453–472  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

451
452 #[test]
453 fn lsn_increments() {
454 let dir = tempfile::tempdir().unwrap();
455 let path = dir.path().join("test.wal");
456
457 let mut writer = WalWriter::open_without_direct_io(&path).unwrap();
458
459 let lsn1 = writer
460 .append(RecordType::Put as u32, 1, 0, 0, b"first")
461 .unwrap();
462 let lsn2 = writer
463 .append(RecordType::Put as u32, 1, 0, 0, b"second")
464 .unwrap();
465 let lsn3 = writer
466 .append(RecordType::Put as u32, 1, 0, 0, b"third")
467 .unwrap();
468
469 assert_eq!(lsn1, 1);
470 assert_eq!(lsn2, 2);
471 assert_eq!(lsn3, 3);
472 }
473
474 #[test]
475 fn sealed_writer_rejects_writes() {

Callers

nothing calls this directly

Calls 3

joinMethod · 0.80
pathMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected