forked from tikv/raft-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfork.rs
More file actions
27 lines (23 loc) · 662 Bytes
/
fork.rs
File metadata and controls
27 lines (23 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use std::path::Path;
use std::sync::Arc;
use raft_engine::Config;
use raft_engine::Engine;
use raft_engine::env::DefaultFileSystem;
fn main() {
let mut args = std::env::args();
let arg0 = args.next().unwrap();
let prog = Path::new(&arg0)
.file_name()
.and_then(|x| x.to_str())
.unwrap();
println!("usage: {prog} {{source}} {{target}}");
let source = args.next().unwrap();
let target = args.next().unwrap();
let cfg = Config {
dir: source,
..Default::default()
};
let fs = Arc::new(DefaultFileSystem);
Engine::<_, _>::fork(&cfg, fs, target).unwrap();
println!("success!");
}