recovery/
recovery.rs

1use sharded_log::Config;
2
3fn main() {
4    let config = Config {
5        path: "path/to/logs".into(),
6        ..Default::default()
7    };
8
9    config.purge().unwrap();
10
11    let sharded_log = config.create().unwrap();
12
13    sharded_log
14        .write_batch(&[b"a", b"b", b"c", b"d"])
15        .unwrap();
16
17    sharded_log.flush().unwrap();
18
19    for write_batch in config.recover().unwrap() {
20        println!("got batch: {:?}", write_batch);
21        assert_eq!(
22            write_batch,
23            vec![b"a", b"b", b"c", b"d"]
24        );
25    }
26
27    let _ = std::fs::remove_dir_all("path");
28}