Merge branch 'master' into ipc-hypervisor
This commit is contained in:
@@ -133,11 +133,11 @@ Networking Options:
|
||||
|
||||
API and Console Options:
|
||||
-j --jsonrpc Enable the JSON-RPC API server.
|
||||
--jsonrpc-port PORT Specify the port portion of the JSONRPC API server
|
||||
[default: 8545].
|
||||
--jsonrpc-interface IP Specify the hostname portion of the JSONRPC API
|
||||
server, IP should be an interface's IP address, or
|
||||
all (all interfaces) or local [default: local].
|
||||
--jsonrpc-port PORT Specify the port portion of the JSONRPC API server
|
||||
[default: 8545].
|
||||
--jsonrpc-cors URL Specify CORS header for JSON-RPC API responses
|
||||
[default: null].
|
||||
--jsonrpc-apis APIS Specify the APIs available through the JSONRPC
|
||||
@@ -176,8 +176,14 @@ Sealing/Mining Options:
|
||||
|
||||
Footprint Options:
|
||||
--pruning METHOD Configure pruning of the state/storage trie. METHOD
|
||||
may be one of: archive, basic (experimental), fast
|
||||
(experimental) [default: archive].
|
||||
may be one of auto, archive, basic, fast, light:
|
||||
archive - keep all state trie data. No pruning.
|
||||
basic - reference count in disk DB. Slow but light.
|
||||
fast - maintain journal overlay. Fast but 50MB used.
|
||||
light - early merges with partial tracking. Fast
|
||||
and light. Experimental!
|
||||
auto - use the method most recently synced or
|
||||
default to archive if none synced [default: auto].
|
||||
--cache-pref-size BYTES Specify the prefered size of the blockchain cache in
|
||||
bytes [default: 16384].
|
||||
--cache-max-size BYTES Specify the maximum size of the blockchain cache in
|
||||
@@ -543,7 +549,26 @@ impl Configuration {
|
||||
ret
|
||||
}
|
||||
|
||||
fn client_config(&self) -> ClientConfig {
|
||||
fn find_best_db(&self, spec: &Spec) -> Option<journaldb::Algorithm> {
|
||||
let mut ret = None;
|
||||
let mut latest_era = None;
|
||||
let jdb_types = [journaldb::Algorithm::Archive, journaldb::Algorithm::EarlyMerge, journaldb::Algorithm::OverlayRecent, journaldb::Algorithm::RefCounted];
|
||||
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);
|
||||
trace!(target: "parity", "Looking for best DB: {} at {:?}", i, db.latest_era());
|
||||
match (latest_era, db.latest_era()) {
|
||||
(Some(best), Some(this)) if best >= this => {}
|
||||
(_, None) => {}
|
||||
(_, Some(this)) => {
|
||||
latest_era = Some(this);
|
||||
ret = Some(*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
ret
|
||||
}
|
||||
|
||||
fn client_config(&self, spec: &Spec) -> ClientConfig {
|
||||
let mut client_config = ClientConfig::default();
|
||||
match self.args.flag_cache {
|
||||
Some(mb) => {
|
||||
@@ -560,8 +585,10 @@ impl Configuration {
|
||||
"light" => journaldb::Algorithm::EarlyMerge,
|
||||
"fast" => journaldb::Algorithm::OverlayRecent,
|
||||
"basic" => journaldb::Algorithm::RefCounted,
|
||||
"auto" => self.find_best_db(spec).unwrap_or(journaldb::Algorithm::OverlayRecent),
|
||||
_ => { die!("Invalid pruning method given."); }
|
||||
};
|
||||
trace!(target: "parity", "Using pruning strategy of {}", client_config.pruning);
|
||||
client_config.name = self.args.flag_identity.clone();
|
||||
client_config.queue.max_mem_use = self.args.flag_queue_max_size;
|
||||
client_config
|
||||
@@ -656,13 +683,14 @@ impl Configuration {
|
||||
let spec = self.spec();
|
||||
let net_settings = self.net_settings(&spec);
|
||||
let sync_config = self.sync_config(&spec);
|
||||
let client_config = self.client_config(&spec);
|
||||
|
||||
// Secret Store
|
||||
let account_service = Arc::new(self.account_service());
|
||||
|
||||
// Build client
|
||||
let mut service = ClientService::start(
|
||||
self.client_config(), spec, net_settings, &Path::new(&self.path())
|
||||
client_config, spec, net_settings, &Path::new(&self.path())
|
||||
).unwrap_or_else(|e| die_with_error(e));
|
||||
|
||||
panic_handler.forward_from(&service);
|
||||
|
||||
@@ -18,13 +18,15 @@
|
||||
|
||||
use semver::Version;
|
||||
use std::collections::*;
|
||||
use std::fs::File;
|
||||
use std::fs::{File, create_dir_all};
|
||||
use std::env;
|
||||
use std::io::{Read, Write};
|
||||
|
||||
#[cfg_attr(feature="dev", allow(enum_variant_names))]
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
CannotLockVersionFile,
|
||||
CannotCreateConfigPath,
|
||||
CannotWriteVersionFile,
|
||||
CannotUpdateVersionFile,
|
||||
}
|
||||
|
||||
@@ -65,7 +67,7 @@ fn dummy_upgrade() -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn push_updrades(upgrades: &mut UpgradeList)
|
||||
fn push_upgrades(upgrades: &mut UpgradeList)
|
||||
{
|
||||
// dummy upgrade (remove when the first one is in)
|
||||
upgrades.insert(
|
||||
@@ -75,7 +77,7 @@ fn push_updrades(upgrades: &mut UpgradeList)
|
||||
|
||||
fn upgrade_from_version(previous_version: &Version) -> Result<usize, Error> {
|
||||
let mut upgrades = HashMap::new();
|
||||
push_updrades(&mut upgrades);
|
||||
push_upgrades(&mut upgrades);
|
||||
|
||||
let current_version = Version::parse(CURRENT_VERSION).unwrap();
|
||||
|
||||
@@ -95,6 +97,7 @@ fn with_locked_version<F>(script: F) -> Result<usize, Error>
|
||||
{
|
||||
let mut path = env::home_dir().expect("Applications should have a home dir");
|
||||
path.push(".parity");
|
||||
try!(create_dir_all(&path).map_err(|_| Error::CannotCreateConfigPath));
|
||||
path.push("ver.lock");
|
||||
|
||||
let version =
|
||||
@@ -107,16 +110,12 @@ fn with_locked_version<F>(script: F) -> Result<usize, Error>
|
||||
})
|
||||
.unwrap_or_else(|| Version::parse("0.9.0").unwrap());
|
||||
|
||||
let script_result = {
|
||||
let mut lock = try!(File::create(&path).map_err(|_| Error::CannotLockVersionFile));
|
||||
let result = script(&version);
|
||||
let mut lock = try!(File::create(&path).map_err(|_| Error::CannotWriteVersionFile));
|
||||
let result = script(&version);
|
||||
|
||||
let written_version = Version::parse(CURRENT_VERSION).unwrap();
|
||||
try!(lock.write_all(written_version.to_string().as_bytes()).map_err(|_| Error::CannotUpdateVersionFile));
|
||||
result
|
||||
};
|
||||
|
||||
script_result
|
||||
let written_version = Version::parse(CURRENT_VERSION).unwrap();
|
||||
try!(lock.write_all(written_version.to_string().as_bytes()).map_err(|_| Error::CannotUpdateVersionFile));
|
||||
result
|
||||
}
|
||||
|
||||
pub fn upgrade() -> Result<usize, Error> {
|
||||
|
||||
Reference in New Issue
Block a user