summaryrefslogtreecommitdiff
path: root/src/bin/benchmark-indexedstore.rs
blob: a4191ac444aff7a3122701612fe4742f47e5676a (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
use obnam::benchmark::ChunkGenerator;
use obnam::indexedstore::IndexedStore;
use std::path::PathBuf;
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
#[structopt(name = "benchmark-store", about = "Benhcmark the store without HTTP")]
struct Opt {
    #[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 store = IndexedStore::new(&opt.chunks);
    for (_, _, meta, chunk) in gen {
        store.save(&meta, &chunk)?;
    }

    Ok(())
}