From c7d621279743275a8766fa253268fb7a8e1c90ca Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 11 Jun 2020 00:48:39 -0400 Subject: finish the first random test code --- examples/demo1.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/demo1.rs b/examples/demo1.rs index 48d7c2c..5ee2b64 100644 --- a/examples/demo1.rs +++ b/examples/demo1.rs @@ -114,10 +114,10 @@ impl WALStore for WALStoreTest { Ok(logfiles.into_iter()) } - fn apply_payload(&mut self, payload: WALBytes, wal_off: WALPos) -> Result<(), ()> { - println!("apply_payload(payload={}, wal_off={})", + fn apply_payload(&mut self, payload: WALBytes, ringid: WALRingId) -> Result<(), ()> { + println!("apply_payload(payload={}, ringid={:?})", std::str::from_utf8(&payload).unwrap(), - wal_off); + ringid); Ok(()) } } @@ -134,7 +134,7 @@ fn test(records: Vec, wal: &mut WALWriter) -> Box<[WALRing fn main() { let mut rng = rand::thread_rng(); let store = WALStoreTest::new("./wal_demo1", true); - let mut wal = WALLoader::new(store, 9, 8, 1000).recover().unwrap(); + let mut wal = WALLoader::new(9, 8, 1000).recover(store).unwrap(); for _ in 0..3 { test(["hi", "hello", "lol"].iter().map(|s| s.to_string()).collect::>(), &mut wal); } @@ -143,13 +143,13 @@ fn main() { } let store = WALStoreTest::new("./wal_demo1", false); - let mut wal = WALLoader::new(store, 9, 8, 1000).recover().unwrap(); + let mut wal = WALLoader::new(9, 8, 1000).recover(store).unwrap(); for _ in 0..3 { test(vec!["a".repeat(10), "b".repeat(100), "c".repeat(300), "d".repeat(400)], &mut wal); } let store = WALStoreTest::new("./wal_demo1", false); - let mut wal = WALLoader::new(store, 9, 8, 1000).recover().unwrap(); + let mut wal = WALLoader::new(9, 8, 1000).recover(store).unwrap(); for _ in 0..3 { let mut ids = Vec::new(); for _ in 0..3 { -- cgit v1.2.3-70-g09d2