Browse Source

Add a simple tool for full compaction benchmarking

refactor-mempool
Roman Zeyde 7 years ago
parent
commit
f66e5e48cc
No known key found for this signature in database GPG Key ID: 87CAE5FA46917CBB
  1. 29
      examples/compact.rs

29
examples/compact.rs

@ -0,0 +1,29 @@
/// Benchmark full compaction.
extern crate electrs;
#[macro_use]
extern crate log;
extern crate error_chain;
use electrs::{config::Config, errors::*, store::DBStore};
use error_chain::ChainedError;
fn run(config: Config) -> Result<()> {
if !config.db_path.exists() {
panic!(
"DB {:?} must exist when running this benchmark!",
config.db_path
);
}
let store = DBStore::open(&config.db_path);
store.compact();
Ok(())
}
fn main() {
if let Err(e) = run(Config::from_args()) {
error!("{}", e.display_chain());
}
}
Loading…
Cancel
Save