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

Function transactions

crates/commitlog/src/segment.rs:895–916  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

893
894 #[test]
895 fn transactions() {
896 let repo = repo::Memory::unlimited();
897 let commits = vec![
898 vec![(0, [1; 32]), (1, [2; 32])],
899 vec![(2, [3; 32])],
900 vec![(3, [4; 32]), (4, [5; 32])],
901 ];
902
903 let mut writer = repo::create_segment_writer(&repo, <_>::default(), Commit::DEFAULT_EPOCH, 0).unwrap();
904 for commit in &commits {
905 writer.commit(commit.clone()).unwrap();
906 }
907
908 writer.flush().unwrap();
909
910 let reader = repo::open_segment_reader(&repo, DEFAULT_LOG_FORMAT_VERSION, 0).unwrap();
911 let txs = reader
912 .transactions(&ArrayDecoder)
913 .collect::<Result<Vec<_>, _>>()
914 .unwrap();
915 assert_eq!(txs, commits.into_iter().flatten().map(Into::into).collect::<Vec<_>>());
916 }
917
918 #[test]
919 fn next_tx_offset() {

Callers

nothing calls this directly

Calls 7

create_segment_writerFunction · 0.85
open_segment_readerFunction · 0.85
commitMethod · 0.65
unwrapMethod · 0.45
cloneMethod · 0.45
flushMethod · 0.45
transactionsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…