aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-08-25 17:35:17 -0400
committerDeterminant <[email protected]>2020-08-25 17:35:17 -0400
commit395bd19d51c5f5e0bfd3b5897ddce5f6bef5ec79 (patch)
tree416234ba859ac761e12b15182adbc6c67a3875d1 /examples
parent5a578e4dac2721b324aff1665b7d2afbe00b5fb3 (diff)
simplify API by moving `recover_func` to `load()`v0.1.5
Diffstat (limited to 'examples')
-rw-r--r--examples/demo1.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/demo1.rs b/examples/demo1.rs
index d51801d..6f029ab 100644
--- a/examples/demo1.rs
+++ b/examples/demo1.rs
@@ -4,9 +4,9 @@ use growthring::{
};
use rand::{seq::SliceRandom, Rng};
-fn test<F: FnMut(WALBytes, WALRingId) -> Result<(), ()>>(
+fn test(
records: Vec<String>,
- wal: &mut WALWriter<WALStoreAIO<F>>,
+ wal: &mut WALWriter<WALStoreAIO>,
) -> Vec<WALRingId> {
let mut res = Vec::new();
for r in wal.grow(records).into_iter() {
@@ -32,8 +32,8 @@ fn main() {
let mut loader = WALLoader::new();
loader.file_nbit(9).block_nbit(8);
- let store = WALStoreAIO::new(&wal_dir, true, recover, None).unwrap();
- let mut wal = loader.load(store).unwrap();
+ let store = WALStoreAIO::new(&wal_dir, true, None).unwrap();
+ let mut wal = loader.load(store, recover).unwrap();
for _ in 0..3 {
test(
["hi", "hello", "lol"]
@@ -50,8 +50,8 @@ fn main() {
);
}
- let store = WALStoreAIO::new(&wal_dir, false, recover, None).unwrap();
- let mut wal = loader.load(store).unwrap();
+ let store = WALStoreAIO::new(&wal_dir, false, None).unwrap();
+ let mut wal = loader.load(store, recover).unwrap();
for _ in 0..3 {
test(
vec![
@@ -64,8 +64,8 @@ fn main() {
);
}
- let store = WALStoreAIO::new(&wal_dir, false, recover, None).unwrap();
- let mut wal = loader.load(store).unwrap();
+ let store = WALStoreAIO::new(&wal_dir, false, None).unwrap();
+ let mut wal = loader.load(store, recover).unwrap();
for _ in 0..3 {
let mut ids = Vec::new();
for _ in 0..3 {