diff --git a/lib/core/network/Cargo.toml b/lib/core/network/Cargo.toml index 9a37748e5dfad1a8c4a83758c9fe5366dfa02165..1b2f8428e9cfe350476552b6c3b6c484f0796836 100644 --- a/lib/core/network/Cargo.toml +++ b/lib/core/network/Cargo.toml @@ -14,6 +14,7 @@ dup-crypto = { path = "../../tools/crypto" } dubp-documents= { path = "../../tools/documents" } durs-module = { path = "../module" } durs-network-documents = { path = "../../tools/network-documents" } +failure = "0.1.5" serde = "1.0.*" serde_derive = "1.0.*" serde_json = "1.0.*" diff --git a/lib/core/network/lib.rs b/lib/core/network/lib.rs index bc286071dda5154b3639fefcd468d477318203ef..1b49e8889327fe527a8579cebf39b07833560468 100644 --- a/lib/core/network/lib.rs +++ b/lib/core/network/lib.rs @@ -35,6 +35,7 @@ use durs_module::*; use durs_network_documents::network_endpoint::ApiFeatures; use durs_network_documents::network_head::NetworkHead; use durs_network_documents::*; +use failure::Fail; use std::fmt::Debug; use std::sync::mpsc; @@ -60,7 +61,7 @@ pub trait NetworkModule<DC: DursConfTrait, M: ModuleMessage>: ApiModule<DC, M> { module_conf: <Self as DursModule<DC, M>>::ModuleConf, main_sender: mpsc::Sender<RouterThreadMessage<M>>, sync_params: SyncOpt, - ) -> Result<(), ModuleInitError>; + ) -> Result<(), SyncError>; } /// Trait to be implemented by the configuration object of the module managing the inter-node network. @@ -74,3 +75,20 @@ pub enum NetworkConsensusError { /// The network module does not determine consensus, there is most likely a fork Fork(), } + +#[derive(Debug, Clone, Fail, PartialEq, Eq, Hash)] +/// Synchronization error +pub enum SyncError { + /// Invalid source + #[fail(display = "invalid source: {}", source)] + InvalidSource { + /// Source + source: String, + }, + /// Unreachable source + #[fail(display = "unreachable source: {}", source)] + UnreachableSource { + /// Source + source: String, + }, +} diff --git a/lib/modules/ws2p/ws2p/src/lib.rs b/lib/modules/ws2p/ws2p/src/lib.rs index 3cadeca7c22c0ae62103bd4d1d7fed5768647c5c..e1ef857ad00199b5cb3cfde5f6f7bff87be1c78f 100644 --- a/lib/modules/ws2p/ws2p/src/lib.rs +++ b/lib/modules/ws2p/ws2p/src/lib.rs @@ -130,7 +130,7 @@ impl NetworkModule<DuRsConf, DursMsg> for WS2PModule { _conf: WS2PConf, _main_sender: mpsc::Sender<RouterThreadMessage<DursMsg>>, _sync_params: SyncOpt, - ) -> Result<(), ModuleInitError> { + ) -> Result<(), SyncError> { unimplemented!() } }