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

Function set_new_epoch

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

Source from the content-addressed store, hash-verified

1407
1408 #[test]
1409 fn set_new_epoch() {
1410 let mut log = Generic::<_, [u8; 32]>::open(repo::Memory::unlimited(), <_>::default()).unwrap();
1411 assert_eq!(log.epoch(), Commit::DEFAULT_EPOCH);
1412 log.commit([(0, [12; 32])]).unwrap();
1413 log.set_epoch(42).unwrap();
1414 assert_eq!(log.epoch(), 42);
1415 log.commit([(1, [13; 32])]).unwrap();
1416
1417 log.flush_and_sync().unwrap();
1418
1419 let epochs = log
1420 .commits_from(0)
1421 .map(Result::unwrap)
1422 .map(|commit| commit.epoch)
1423 .collect::<Vec<_>>();
1424 assert_eq!(&[Commit::DEFAULT_EPOCH, 42], epochs.as_slice());
1425 }
1426
1427 #[test]
1428 fn set_lower_epoch_returns_error() {

Callers

nothing calls this directly

Calls 7

commitMethod · 0.65
openFunction · 0.50
unwrapMethod · 0.45
set_epochMethod · 0.45
flush_and_syncMethod · 0.45
mapMethod · 0.45
commits_fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…