summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-06-11 00:48:39 -0400
committerDeterminant <[email protected]>2020-06-11 00:48:39 -0400
commitc7d621279743275a8766fa253268fb7a8e1c90ca (patch)
tree9460a7e4eb02eb4fcfc4771b81b2f80139bb565d /examples
parent350f2638cb3e15df231381b8fd286595058b7a54 (diff)
finish the first random test code
Diffstat (limited to 'examples')
-rw-r--r--examples/demo1.rs12
1 files changed, 6 insertions, 6 deletions
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<String>, wal: &mut WALWriter<WALStoreTest>) -> 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::<Vec<String>>(), &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 {