More work.
This commit is contained in:
parent
4c9bb5aa25
commit
9d3b2352cc
@ -54,7 +54,7 @@ use blockchain::{BlockChain, BlockProvider, TreeRoute, ImportRoute};
|
||||
use client::{
|
||||
BlockId, TransactionId, UncleId, TraceId, ClientConfig, BlockChainClient,
|
||||
MiningBlockChainClient, TraceFilter, CallAnalytics, BlockImportError, Mode,
|
||||
ChainNotify,
|
||||
ChainNotify, UpdatePolicy,
|
||||
};
|
||||
use client::Error as ClientError;
|
||||
use env_info::EnvInfo;
|
||||
@ -129,6 +129,7 @@ impl SleepState {
|
||||
/// Call `import_block()` to import a block asynchronously; `flush_queue()` flushes the queue.
|
||||
pub struct Client {
|
||||
mode: Mutex<Mode>,
|
||||
update_policy: UpdatePolicy,
|
||||
chain: RwLock<Arc<BlockChain>>,
|
||||
tracedb: RwLock<TraceDB<BlockChain>>,
|
||||
engine: Arc<Engine>,
|
||||
|
@ -66,6 +66,35 @@ impl FromStr for DatabaseCompactionProfile {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
pub enum UpdateFilter {
|
||||
All,
|
||||
Patch,
|
||||
Critical,
|
||||
None,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
pub struct UpdatePolicy {
|
||||
download_only: bool,
|
||||
track: Track,
|
||||
}
|
||||
|
||||
/// Operating mode for the client.
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
pub enum UpdatePolicy {
|
||||
/// Always on.
|
||||
Active,
|
||||
/// Goes offline after RLP is inactive for some (given) time, but
|
||||
/// comes back online after a while of inactivity.
|
||||
Passive(Duration, Duration),
|
||||
/// Goes offline after RLP is inactive for some (given) time and
|
||||
/// stays inactive.
|
||||
Dark(Duration),
|
||||
/// Always off.
|
||||
Off,
|
||||
}
|
||||
|
||||
/// Operating mode for the client.
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
pub enum Mode {
|
||||
|
@ -26,7 +26,7 @@ mod client;
|
||||
mod updater;
|
||||
|
||||
pub use self::client::*;
|
||||
pub use self::config::{Mode, ClientConfig, DatabaseCompactionProfile, BlockChainConfig, VMType};
|
||||
pub use self::config::{Mode, ClientConfig, UpdatePolicy, Automation, DatabaseCompactionProfile, BlockChainConfig, VMType};
|
||||
pub use self::error::Error;
|
||||
pub use types::ids::*;
|
||||
pub use self::test_client::{TestBlockChainClient, EachBlockWith};
|
||||
|
@ -34,6 +34,8 @@ pub struct Updater {
|
||||
client: Weak<Client>,
|
||||
operations: Operations,
|
||||
|
||||
|
||||
|
||||
pub this: VersionInfo,
|
||||
pub release_info: Option<ReleaseInfo>,
|
||||
|
||||
|
@ -77,6 +77,7 @@ usage! {
|
||||
flag_mode: String = "last", or |c: &Config| otry!(c.parity).mode.clone(),
|
||||
flag_mode_timeout: u64 = 300u64, or |c: &Config| otry!(c.parity).mode_timeout.clone(),
|
||||
flag_mode_alarm: u64 = 3600u64, or |c: &Config| otry!(c.parity).mode_alarm.clone(),
|
||||
flag_auto_update: String = "consensus", or |c: &Config| otry!(c.parity).auto_update.clone(),
|
||||
flag_chain: String = "homestead", or |c: &Config| otry!(c.parity).chain.clone(),
|
||||
flag_db_path: String = "$HOME/.parity", or |c: &Config| otry!(c.parity).db_path.clone(),
|
||||
flag_keys_path: String = "$HOME/.parity/keys", or |c: &Config| otry!(c.parity).keys_path.clone(),
|
||||
@ -501,6 +502,7 @@ mod tests {
|
||||
flag_mode: "last".into(),
|
||||
flag_mode_timeout: 300u64,
|
||||
flag_mode_alarm: 3600u64,
|
||||
flag_auto_update: "consensus".into(),
|
||||
flag_chain: "xyz".into(),
|
||||
flag_db_path: "$HOME/.parity".into(),
|
||||
flag_keys_path: "$HOME/.parity/keys".into(),
|
||||
|
@ -24,20 +24,23 @@ Operating Options:
|
||||
wakes regularly to resync.
|
||||
dark - Parity syncs only when the RPC is active.
|
||||
offline - Parity doesn't sync. (default: {flag_mode}).
|
||||
--updates POLICY Set the client updating policy. POLICY specifies
|
||||
which updates Parity will auto-install:
|
||||
track - All updates in the current release track.
|
||||
patch - All updates of the current minor version.
|
||||
critical - Only consensus/security updates.
|
||||
none - No updates. Not recommended.
|
||||
--no-consensus Force the binary to run even if there are known
|
||||
issues regarding consensus. Not recommended.
|
||||
--mode-timeout SECS Specify the number of seconds before inactivity
|
||||
timeout occurs when mode is dark or passive
|
||||
(default: {flag_mode_timeout}).
|
||||
--mode-alarm SECS Specify the number of seconds before auto sleep
|
||||
reawake timeout occurs when mode is passive
|
||||
(default: {flag_mode_alarm}).
|
||||
--auto-update TRACK Set a release track to automatically update and
|
||||
install.
|
||||
all - All updates in the current release track.
|
||||
patch - All updates of the current minor version.
|
||||
critical - Only consensus/security updates.
|
||||
none - No updates will be auto-installed.
|
||||
(default: {flag_auto_update}).
|
||||
--no-download Normally new releases will be downloaded ready for
|
||||
updating. This disables it. Not recommended.
|
||||
--no-consensus Force the binary to run even if there are known
|
||||
issues regarding consensus. Not recommended.
|
||||
--chain CHAIN Specify the blockchain type. CHAIN may be either a
|
||||
JSON chain specification file or olympic, frontier,
|
||||
homestead, mainnet, morden, ropsten, classic, expanse,
|
||||
|
@ -23,7 +23,7 @@ use cli::{Args, ArgsError};
|
||||
use util::{Hashable, U256, Uint, Bytes, version_data, Secret, Address};
|
||||
use util::log::Colour;
|
||||
use ethsync::{NetworkConfiguration, is_valid_node_url, AllowIP};
|
||||
use ethcore::client::VMType;
|
||||
use ethcore::client::{VMType, UpdatePolicy};
|
||||
use ethcore::miner::{MinerOptions, Banning};
|
||||
|
||||
use rpc::{IpcConfiguration, HttpConfiguration};
|
||||
@ -585,6 +585,10 @@ impl Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
fn update_policy(&self) -> UpdatePolicy {
|
||||
|
||||
}
|
||||
|
||||
fn directories(&self) -> Directories {
|
||||
use util::path;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user