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

Function create_and_append

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

Source from the content-addressed store, hash-verified

342
343 #[test]
344 fn create_and_append() {
345 let dir = tempfile::tempdir().unwrap();
346 let wal_dir = dir.path().join("wal");
347
348 let mut wal = SegmentedWal::open(test_config(&wal_dir)).unwrap();
349 let lsn1 = wal
350 .append(RecordType::Put as u32, 1, 0, 0, b"hello")
351 .unwrap();
352 let lsn2 = wal
353 .append(RecordType::Put as u32, 1, 0, 0, b"world")
354 .unwrap();
355 wal.sync().unwrap();
356
357 assert_eq!(lsn1, 1);
358 assert_eq!(lsn2, 2);
359 assert_eq!(wal.next_lsn(), 3);
360 }
361
362 #[test]
363 fn replay_after_close() {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected