aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-06-16 18:03:12 -0400
committerDeterminant <[email protected]>2020-06-16 18:03:12 -0400
commit6ee65d83d983ecc35f596f516d2739e7a91b9efa (patch)
tree59c5912f7f6fa73151c2f8a98de72e1167d64eeb /tests
parent1089cf85a74887430d5d21c42886a4a05bac2be9 (diff)
improve WALLoader; verify CRC32
Diffstat (limited to 'tests')
-rw-r--r--tests/common/mod.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index b61233b..247b2ee 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -3,7 +3,7 @@
#[allow(dead_code)]
use async_trait::async_trait;
use growthring::wal::{
- WALBytes, WALFile, WALLoader, WALPos, WALRingId, WALStore,
+ WALBytes, WALFile, WALLoader, WALPos, WALRingId, WALStore, RecoverPolicy
};
use indexmap::{map::Entry, IndexMap};
use rand::Rng;
@@ -531,15 +531,14 @@ impl PaintingSim {
&self,
state: &mut WALStoreEmulState,
canvas: &mut Canvas,
- wal: WALLoader,
+ loader: WALLoader,
ops: &mut Vec<PaintStrokes>,
ringid_map: &mut HashMap<WALRingId, usize>,
fgen: Rc<G>,
) -> Result<(), ()> {
let mut rng =
<rand::rngs::StdRng as rand::SeedableRng>::seed_from_u64(self.seed);
- let mut wal =
- wal.recover(WALStoreEmul::new(state, fgen.clone(), |_, _| {}))?;
+ let mut wal = loader.load(WALStoreEmul::new(state, fgen.clone(), |_, _| {}))?;
for _ in 0..self.n {
let pss = (0..self.m)
.map(|_| {
@@ -597,7 +596,11 @@ impl PaintingSim {
}
pub fn get_walloader(&self) -> WALLoader {
- WALLoader::new(self.file_nbit, self.block_nbit, self.file_cache)
+ let mut loader = WALLoader::new();
+ loader.file_nbit(self.file_nbit)
+ .block_nbit(self.block_nbit)
+ .cache_size(self.file_cache);
+ loader
}
pub fn get_nticks(&self, state: &mut WALStoreEmulState) -> usize {
@@ -631,7 +634,7 @@ impl PaintingSim {
let mut last_idx = 0;
let mut napplied = 0;
canvas.clear_queued();
- wal.recover(WALStoreEmul::new(
+ wal.load(WALStoreEmul::new(
state,
Rc::new(ZeroFailGen),
|payload, ringid| {