diff options
author | Determinant <[email protected]> | 2020-06-16 18:03:12 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-06-16 18:03:12 -0400 |
commit | 6ee65d83d983ecc35f596f516d2739e7a91b9efa (patch) | |
tree | 59c5912f7f6fa73151c2f8a98de72e1167d64eeb /examples | |
parent | 1089cf85a74887430d5d21c42886a4a05bac2be9 (diff) |
improve WALLoader; verify CRC32
Diffstat (limited to 'examples')
-rw-r--r-- | examples/demo1.rs | 11 |
1 files changed, 7 insertions, 4 deletions
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 { |