From af2c79d1963c49402d5b47e916ffb6b0210c79d1 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 25 Nov 2020 08:11:57 +0200 Subject: feat: add programs to benchmark server chunk storage --- src/bin/benchmark-index.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/bin/benchmark-index.rs (limited to 'src/bin/benchmark-index.rs') diff --git a/src/bin/benchmark-index.rs b/src/bin/benchmark-index.rs new file mode 100644 index 0000000..5008660 --- /dev/null +++ b/src/bin/benchmark-index.rs @@ -0,0 +1,33 @@ +use obnam::benchmark::ChunkGenerator; +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::default(); + for (id, checksum, _, _) in gen { + index.insert(id, "sha25", &checksum); + } + + Ok(()) +} -- cgit v1.2.1