Skip to content
Snippets Groups Projects
Commit fbd9381e authored by Éloïs's avatar Éloïs
Browse files

[ref] network: create SyncError

parent c9adcb5c
No related branches found
No related tags found
1 merge request!151Resolve "Allow several network modules"
......@@ -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.*"
......
......@@ -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,
},
}
......@@ -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!()
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment