mirror of
https://github.com/romanz/electrs.git
synced 2024-11-19 01:43:29 +01:00
Use simple progress bar for indexing
This commit is contained in:
parent
09d4df49f3
commit
9ee7714cb0
@ -8,6 +8,7 @@ bitcoin = "0.12"
|
||||
byteorder = "1.2.2"
|
||||
itertools = "0.7.8"
|
||||
log = "0.4"
|
||||
pbr = "1.0.0"
|
||||
reqwest = "0.8.5"
|
||||
rocksdb = "0.10.0" #{ path = "../../rust-rocksdb" }
|
||||
rust-crypto = "^0.2"
|
||||
|
@ -2,6 +2,7 @@ extern crate bitcoin;
|
||||
extern crate byteorder;
|
||||
extern crate crypto;
|
||||
extern crate itertools;
|
||||
extern crate pbr;
|
||||
extern crate reqwest;
|
||||
extern crate rocksdb;
|
||||
extern crate simple_logger;
|
||||
@ -106,14 +107,13 @@ fn index_blocks(store: &mut Store) {
|
||||
if hashes.is_empty() {
|
||||
return;
|
||||
}
|
||||
info!("indexing {} blocks", hashes.len());
|
||||
|
||||
let mut timer = Timer::new();
|
||||
|
||||
let mut blocks_size = 0usize;
|
||||
let mut rows_size = 0usize;
|
||||
let mut num_of_rows = 0usize;
|
||||
|
||||
let mut pb = pbr::ProgressBar::new(hashes.len() as u64);
|
||||
for (height, blockhash) in hashes {
|
||||
timer.start("get");
|
||||
let buf: Bytes = daemon::get_bin(&format!("block/{}.bin", &blockhash));
|
||||
@ -135,6 +135,7 @@ fn index_blocks(store: &mut Store) {
|
||||
timer.stop();
|
||||
blocks_size += buf.len();
|
||||
|
||||
pb.inc();
|
||||
debug!(
|
||||
"{} @ {}: {:.3}/{:.3} MB, {} rows, {}",
|
||||
blockhash,
|
||||
@ -146,6 +147,7 @@ fn index_blocks(store: &mut Store) {
|
||||
);
|
||||
}
|
||||
store.flush();
|
||||
pb.finish();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
Loading…
Reference in New Issue
Block a user