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

Function uring_write_and_read_roundtrip

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

Source from the content-addressed store, hash-verified

318
319 #[test]
320 fn uring_write_and_read_roundtrip() {
321 let dir = tempfile::tempdir().unwrap();
322 let path = dir.path().join("uring.wal");
323
324 {
325 let mut writer = UringWriter::open_without_direct_io(&path).unwrap();
326 writer
327 .append(RecordType::Put as u32, 1, 0, 0, b"hello-uring")
328 .unwrap();
329 writer
330 .append(RecordType::Put as u32, 2, 1, 0, b"world-uring")
331 .unwrap();
332 writer.submit_and_sync().unwrap();
333 }
334
335 let reader = WalReader::open(&path).unwrap();
336 let records: Vec<_> = reader
337 .records()
338 .collect::<crate::error::Result<_>>()
339 .unwrap();
340 assert_eq!(records.len(), 2);
341 assert_eq!(records[0].payload, b"hello-uring");
342 assert_eq!(records[1].payload, b"world-uring");
343 assert_eq!(records[0].header.lsn, 1);
344 assert_eq!(records[1].header.lsn, 2);
345 }
346
347 #[test]
348 fn uring_group_commit_many_records() {

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