cli config

This commit is contained in:
Nikolay Volf 2016-06-27 14:25:50 +02:00 committed by arkpar
parent 93facbf854
commit a3f165cf48
2 changed files with 5 additions and 4 deletions

View File

@ -26,7 +26,7 @@ use die::*;
use util::*; use util::*;
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use util::network_settings::NetworkSettings; use util::network_settings::NetworkSettings;
use ethcore::client::{append_path, get_db_path, ClientConfig, Switch, VMType}; use ethcore::client::{append_path, get_db_path, ClientConfig, DatabaseCompactionProfile, Switch, VMType};
use ethcore::ethereum; use ethcore::ethereum;
use ethcore::spec::Spec; use ethcore::spec::Spec;
use ethsync::SyncConfig; use ethsync::SyncConfig;
@ -227,7 +227,7 @@ impl Configuration {
let mut latest_era = None; let mut latest_era = None;
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, None); let db = journaldb::new(&append_path(&get_db_path(Path::new(&self.path()), *i, spec.genesis_header().hash()), "state"), *i, kvdb::DatabaseConfig::default());
trace!(target: "parity", "Looking for best DB: {} at {:?}", i, db.latest_era()); 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 => {}
@ -279,7 +279,7 @@ impl Configuration {
client_config.db_cache_size = self.args.flag_db_cache_size.and_then(|cs| Some(cs / 4)); client_config.db_cache_size = self.args.flag_db_cache_size.and_then(|cs| Some(cs / 4));
// compaction profile // compaction profile
client_config.db_compaction_profile = match self.args.flag_db_compaction.as_str() { client_config.db_compaction = match self.args.flag_db_compaction.as_str() {
"default" => DatabaseCompactionProfile::Default, "default" => DatabaseCompactionProfile::Default,
"hdd" => DatabaseCompactionProfile::HDD, "hdd" => DatabaseCompactionProfile::HDD,
_ => { die!("Invalid compaction profile given (--db-compaction argument), expected hdd/default."); } _ => { die!("Invalid compaction profile given (--db-compaction argument), expected hdd/default."); }

View File

@ -20,7 +20,7 @@ use std::io::{Read, Write, Error as IoError, ErrorKind};
use std::path::PathBuf; use std::path::PathBuf;
use std::fmt::{Display, Formatter, Error as FmtError}; use std::fmt::{Display, Formatter, Error as FmtError};
use util::migration::{Manager as MigrationManager, Config as MigrationConfig, MigrationIterator}; use util::migration::{Manager as MigrationManager, Config as MigrationConfig, MigrationIterator};
use util::kvdb::{Database, DatabaseConfig}; use util::kvdb::{Database, DatabaseConfig, CompactionProfile};
use ethcore::migrations; use ethcore::migrations;
/// Database is assumed to be at default version, when no version file is found. /// Database is assumed to be at default version, when no version file is found.
@ -163,6 +163,7 @@ fn migrate_database(version: u32, path: PathBuf, migrations: MigrationManager) -
prefix_size: None, prefix_size: None,
max_open_files: 64, max_open_files: 64,
cache_size: None, cache_size: None,
compaction: CompactionProfile::default(),
}; };
// open old database // open old database