summaryrefslogtreecommitdiff
path: root/src/bin/benchmark-indexedstore.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-11-25 08:38:01 +0000
committerLars Wirzenius <liw@liw.fi>2020-11-25 08:38:01 +0000
commit92645ef73253166296b5a6c8570729a933e55938 (patch)
treeeea17935c844844a6a4ca5620ee5dae4ede6ce14 /src/bin/benchmark-indexedstore.rs
parent02684a9c68ffc87d20ba89852fbcba43ed521039 (diff)
parentaf2c79d1963c49402d5b47e916ffb6b0210c79d1 (diff)
downloadobnam2-92645ef73253166296b5a6c8570729a933e55938.tar.gz
Merge branch 'benchmark-store' into 'main'
feat: add programs to benchmark server chunk storage See merge request larswirzenius/obnam!23
Diffstat (limited to 'src/bin/benchmark-indexedstore.rs')
-rw-r--r--src/bin/benchmark-indexedstore.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/bin/benchmark-indexedstore.rs b/src/bin/benchmark-indexedstore.rs
new file mode 100644
index 0000000..a4191ac
--- /dev/null
+++ b/src/bin/benchmark-indexedstore.rs
@@ -0,0 +1,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(())
+}