IPC (feature-gated) (#1654)
* moving ipc deriving to trait * refactoring of the client * all compiled * proved all working * warnings purged * allow hypervisor to specify initialization payload in two ways * using binary initialisation payload for sync * some docs * logger to separate crate * log settings for sync bin * forwarding logging arguments to the sync
This commit is contained in:
committed by
Arkadiy Paronyan
parent
7ae9e61d6c
commit
8ab56ea3d1
@@ -32,6 +32,7 @@ use parking_lot::RwLock;
|
||||
pub const ETH_PROTOCOL: &'static str = "eth";
|
||||
|
||||
/// Sync configuration
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SyncConfig {
|
||||
/// Max blocks to download ahead
|
||||
pub max_download_ahead_blocks: usize,
|
||||
@@ -272,3 +273,9 @@ impl From<BasicNetworkConfiguration> for NetworkConfiguration {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Binary, Clone)]
|
||||
pub struct ServiceConfiguration {
|
||||
pub sync: SyncConfig,
|
||||
pub net: NetworkConfiguration,
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ mod api {
|
||||
include!(concat!(env!("OUT_DIR"), "/api.ipc.rs"));
|
||||
}
|
||||
|
||||
pub use api::{EthSync, SyncProvider, ManageNetwork, SyncConfig, NetworkConfiguration};
|
||||
pub use api::{EthSync, SyncProvider, SyncClient, NetworkManagerClient, ManageNetwork, SyncConfig,
|
||||
NetworkConfiguration, ServiceConfiguration};
|
||||
pub use chain::{SyncStatus, SyncState};
|
||||
|
||||
|
||||
@@ -15,4 +15,5 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pub mod helpers;
|
||||
mod chain;
|
||||
mod chain;
|
||||
mod rpc;
|
||||
|
||||
29
sync/src/tests/rpc.rs
Normal file
29
sync/src/tests/rpc.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use super::super::NetworkConfiguration;
|
||||
use util::NetworkConfiguration as BasicNetworkConfiguration;
|
||||
use std::convert::From;
|
||||
use ipc::binary::{serialize, deserialize};
|
||||
|
||||
#[test]
|
||||
fn network_settings_serialize() {
|
||||
let net_cfg = NetworkConfiguration::from(BasicNetworkConfiguration::new_local());
|
||||
let serialized = serialize(&net_cfg).unwrap();
|
||||
let deserialized = deserialize::<NetworkConfiguration>(&serialized).unwrap();
|
||||
|
||||
assert_eq!(net_cfg.udp_port, deserialized.udp_port);
|
||||
}
|
||||
Reference in New Issue
Block a user