blob: d49a6c36ed1194381637c254a276c29cac93454a (
plain)
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
28
29
30
31
32
33
34
35
|
use obnam::benchmark::ChunkGenerator;
use obnam::chunkmeta::ChunkMeta;
use obnam::index::Index;
use std::path::PathBuf;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(
name = "benchmark-index",
about = "Benhcmark the store index in memory"
)]
struct Opt {
// We don't use this, but we accept it for command line
// compatibility with other benchmark programs.
#[structopt(parse(from_os_str))]
chunks: PathBuf,
#[structopt()]
num: u32,
}
fn main() -> anyhow::Result<()> {
pretty_env_logger::init();
let opt = Opt::from_args();
let gen = ChunkGenerator::new(opt.num);
let mut index = Index::new(".")?;
for (id, checksum, _, _) in gen {
let meta = ChunkMeta::new(&checksum);
index.insert_meta(id, meta)?;
}
Ok(())
}
|