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

Function reset_to_offset

crates/commitlog/src/commitlog.rs:1325–1347  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1323
1324 #[test]
1325 fn reset_to_offset() {
1326 enable_logging();
1327
1328 let mut log = mem_log::<[u8; 32]>(128);
1329 let total_txs = fill_log(&mut log, 50, repeat(1)) as u64;
1330
1331 for offset in (0..total_txs).rev() {
1332 log = log.reset_to(offset).unwrap();
1333 assert_eq!(
1334 offset,
1335 log.transactions_from(0, &ArrayDecoder)
1336 .map(Result::unwrap)
1337 .last()
1338 .unwrap()
1339 .offset
1340 );
1341 // We're counting from zero, so offset + 1 is the # of txs.
1342 assert_eq!(
1343 offset + 1,
1344 log.transactions_from(0, &ArrayDecoder).map(Result::unwrap).count() as u64
1345 );
1346 }
1347 }
1348
1349 #[test]
1350 fn reset_to_offset_many_txs_per_commit() {

Callers

nothing calls this directly

Calls 4

enable_loggingFunction · 0.50
fill_logFunction · 0.50
unwrapMethod · 0.45
reset_toMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…