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

Function uring_reopen_continues_lsn

nodedb-wal/src/uring_writer.rs:373–404  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

371
372 #[test]
373 fn uring_reopen_continues_lsn() {
374 let dir = tempfile::tempdir().unwrap();
375 let path = dir.path().join("uring_reopen.wal");
376
377 {
378 let mut writer = UringWriter::open_without_direct_io(&path).unwrap();
379 writer
380 .append(RecordType::Put as u32, 1, 0, 0, b"first")
381 .unwrap();
382 writer
383 .append(RecordType::Put as u32, 1, 0, 0, b"second")
384 .unwrap();
385 writer.submit_and_sync().unwrap();
386 }
387
388 {
389 let mut writer = UringWriter::open_without_direct_io(&path).unwrap();
390 assert_eq!(writer.next_lsn(), 3);
391 let lsn = writer
392 .append(RecordType::Put as u32, 1, 0, 0, b"third")
393 .unwrap();
394 assert_eq!(lsn, 3);
395 writer.submit_and_sync().unwrap();
396 }
397
398 let reader = WalReader::open(&path).unwrap();
399 let records: Vec<_> = reader
400 .records()
401 .collect::<crate::error::Result<_>>()
402 .unwrap();
403 assert_eq!(records.len(), 3);
404 }
405}

Callers

nothing calls this directly

Calls 6

joinMethod · 0.80
submit_and_syncMethod · 0.80
openFunction · 0.50
pathMethod · 0.45
appendMethod · 0.45
recordsMethod · 0.45

Tested by

no test coverage detected