MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / fill_log

Function fill_log

crates/commitlog/src/tests/partial.rs:33–49  ·  view source on GitHub ↗
(mut log: commitlog::Generic<ShortMem, [u8; 32]>, range: Range<TxOffset>)

Source from the content-addressed store, hash-verified

31}
32
33fn fill_log(mut log: commitlog::Generic<ShortMem, [u8; 32]>, range: Range<TxOffset>) {
34 debug!("writing range {range:?}");
35
36 let end = range.end;
37 for i in range {
38 info!("commit {i}");
39 log.commit([(i, [b'z'; 32])]).unwrap();
40 }
41 log.flush().unwrap();
42
43 // Try to write one more, which should fail.
44 log.commit([(end, [b'x'; 32])]).unwrap();
45 assert_matches!(
46 log.flush(),
47 Err(e) if e.kind() == io::ErrorKind::StorageFull
48 );
49}
50
51/// Tests that, when a partial write occurs, we can read all flushed commits
52/// up until the faulty one.

Callers 2

Calls 3

commitMethod · 0.65
unwrapMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…