From 6ee65d83d983ecc35f596f516d2739e7a91b9efa Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 16 Jun 2020 18:03:12 -0400 Subject: improve WALLoader; verify CRC32 --- examples/demo1.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/demo1.rs b/examples/demo1.rs index 4a923c6..e214177 100644 --- a/examples/demo1.rs +++ b/examples/demo1.rs @@ -1,5 +1,5 @@ use growthring::{ - wal::{WALBytes, WALLoader, WALRingId, WALWriter}, + wal::{WALBytes, WALRingId, WALLoader, WALWriter}, WALStoreAIO, }; use rand::{seq::SliceRandom, Rng}; @@ -29,8 +29,11 @@ fn recover(payload: WALBytes, ringid: WALRingId) -> Result<(), ()> { fn main() { let wal_dir = "./wal_demo1"; let mut rng = rand::thread_rng(); + let mut loader = WALLoader::new(); + loader.file_nbit(9).block_nbit(8); + let store = WALStoreAIO::new(&wal_dir, true, recover); - let mut wal = WALLoader::new(9, 8, 1000).recover(store).unwrap(); + let mut wal = loader.load(store).unwrap(); for _ in 0..3 { test( ["hi", "hello", "lol"] @@ -48,7 +51,7 @@ fn main() { } let store = WALStoreAIO::new(&wal_dir, false, recover); - let mut wal = WALLoader::new(9, 8, 1000).recover(store).unwrap(); + let mut wal = loader.load(store).unwrap(); for _ in 0..3 { test( vec![ @@ -62,7 +65,7 @@ fn main() { } let store = WALStoreAIO::new(&wal_dir, false, recover); - let mut wal = WALLoader::new(9, 8, 1000).recover(store).unwrap(); + let mut wal = loader.load(store).unwrap(); for _ in 0..3 { let mut ids = Vec::new(); for _ in 0..3 { -- cgit v1.2.3-70-g09d2