Tracing and docs. (#952)

This commit is contained in:
Gav Wood 2016-04-13 11:26:41 -07:00
parent 30dc58ce49
commit 32ca8066e9
2 changed files with 4 additions and 1 deletions

View File

@ -127,6 +127,7 @@ impl Client<CanonVerifier> {
} }
} }
/// Get the path for the databases given the root path and information on the databases.
pub fn get_db_path(path: &Path, pruning: journaldb::Algorithm, genesis_hash: H256) -> PathBuf { pub fn get_db_path(path: &Path, pruning: journaldb::Algorithm, genesis_hash: H256) -> PathBuf {
let mut dir = path.to_path_buf(); let mut dir = path.to_path_buf();
dir.push(H64::from(genesis_hash).hex()); dir.push(H64::from(genesis_hash).hex());
@ -136,6 +137,7 @@ pub fn get_db_path(path: &Path, pruning: journaldb::Algorithm, genesis_hash: H25
dir dir
} }
/// Append a path element to the given path and return the string.
pub fn append_path(path: &Path, item: &str) -> String { pub fn append_path(path: &Path, item: &str) -> String {
let mut p = path.to_path_buf(); let mut p = path.to_path_buf();
p.push(item); p.push(item);

View File

@ -550,6 +550,7 @@ impl Configuration {
let jdb_types = [journaldb::Algorithm::Archive, journaldb::Algorithm::EarlyMerge, journaldb::Algorithm::OverlayRecent, journaldb::Algorithm::RefCounted]; let jdb_types = [journaldb::Algorithm::Archive, journaldb::Algorithm::EarlyMerge, journaldb::Algorithm::OverlayRecent, journaldb::Algorithm::RefCounted];
for i in jdb_types.into_iter() { for i in jdb_types.into_iter() {
let db = journaldb::new(&append_path(&get_db_path(&Path::new(&self.path()), *i, spec.genesis_header().hash()), "state"), *i); let db = journaldb::new(&append_path(&get_db_path(&Path::new(&self.path()), *i, spec.genesis_header().hash()), "state"), *i);
trace!(target: "parity", "Looking for best DB: {} at {:?}", i, db.latest_era());
match (latest_era, db.latest_era()) { match (latest_era, db.latest_era()) {
(Some(best), Some(this)) if best >= this => {} (Some(best), Some(this)) if best >= this => {}
(_, None) => {} (_, None) => {}
@ -582,7 +583,7 @@ impl Configuration {
"auto" => self.find_best_db(spec).unwrap_or(journaldb::Algorithm::OverlayRecent), "auto" => self.find_best_db(spec).unwrap_or(journaldb::Algorithm::OverlayRecent),
_ => { die!("Invalid pruning method given."); } _ => { die!("Invalid pruning method given."); }
}; };
info!("Using state DB of {}", client_config.pruning); trace!(target: "parity", "Using pruning strategy of {}", client_config.pruning);
client_config.name = self.args.flag_identity.clone(); client_config.name = self.args.flag_identity.clone();
client_config.queue.max_mem_use = self.args.flag_queue_max_size; client_config.queue.max_mem_use = self.args.flag_queue_max_size;
client_config client_config