Commit 2de7fd72 authored by Éloïs's avatar Éloïs

[ref] rework DursMsg enum & move dal to blockchain sublib

parent 2c6e8f2c
......@@ -101,9 +101,9 @@ tests:win64:stable:
- cargo test --package duniter-module --target=x86_64-pc-windows-gnu
- cargo test --package duniter-network --target=x86_64-pc-windows-gnu
- cargo test --package duniter-conf --target=x86_64-pc-windows-gnu
- cargo test --package duniter-dal --target=x86_64-pc-windows-gnu
- cargo test --package duniter-message --target=x86_64-pc-windows-gnu
- cargo test --package duniter-blockchain --target=x86_64-pc-windows-gnu
- cargo test --package durs-blockchain-dal --target=x86_64-pc-windows-gnu
- cargo test --package durs-message --target=x86_64-pc-windows-gnu
- cargo test --package durs-blockchain --target=x86_64-pc-windows-gnu
- cargo test --package duniter-core --target=x86_64-pc-windows-gnu
#- cargo test --package durs-skeleton-module --target=x86_64-pc-windows-gnu
......
......@@ -243,30 +243,6 @@ dependencies = [
"serde_json 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "duniter-blockchain"
version = "0.1.0-a0.1"
dependencies = [
"dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.11.0",
"duniter-conf 0.1.0-a0.1",
"duniter-dal 0.1.0-a0.1",
"duniter-message 0.1.0-a0.1",
"duniter-module 0.1.0-a0.1",
"duniter-network 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-network-documents 0.3.0",
"durs-wot 0.8.0-a0.9",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pbr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustbreak 2.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
"sqlite 0.23.9 (registry+https://github.com/rust-lang/crates.io-index)",
"threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "duniter-conf"
version = "0.1.0-a0.1"
......@@ -287,12 +263,12 @@ name = "duniter-core"
version = "0.1.0-a0.1"
dependencies = [
"dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"duniter-blockchain 0.1.0-a0.1",
"duniter-conf 0.1.0-a0.1",
"duniter-message 0.1.0-a0.1",
"duniter-module 0.1.0-a0.1",
"duniter-network 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-blockchain 0.1.0-a0.1",
"durs-message 0.1.0-a0.1",
"durs-network-documents 0.3.0",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -305,28 +281,24 @@ dependencies = [
]
[[package]]
name = "duniter-dal"
name = "duniter-module"
version = "0.1.0-a0.1"
dependencies = [
"dubp-documents 0.11.0",
"duniter-module 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-wot 0.8.0-a0.9",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustbreak 2.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)",
"durs-network-documents 0.3.0",
"serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "duniter-message"
name = "duniter-network"
version = "0.1.0-a0.1"
dependencies = [
"dubp-documents 0.11.0",
"duniter-dal 0.1.0-a0.1",
"duniter-module 0.1.0-a0.1",
"duniter-network 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-network-documents 0.3.0",
"serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -335,73 +307,80 @@ dependencies = [
]
[[package]]
name = "duniter-module"
version = "0.1.0-a0.1"
name = "dup-crypto"
version = "0.5.0"
dependencies = [
"dubp-documents 0.11.0",
"dup-crypto 0.5.0",
"durs-network-documents 0.3.0",
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto-wasm 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "durs"
version = "0.1.0-a1"
dependencies = [
"duniter-core 0.1.0-a0.1",
"durs-tui 0.1.0-a0.1",
"durs-ws2p 0.1.0-a0.1",
"durs-ws2p-v1-legacy 0.1.0-a0.1",
"structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "duniter-network"
name = "durs-blockchain"
version = "0.1.0-a0.1"
dependencies = [
"dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.11.0",
"duniter-conf 0.1.0-a0.1",
"duniter-module 0.1.0-a0.1",
"duniter-network 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-blockchain-dal 0.1.0-a0.1",
"durs-message 0.1.0-a0.1",
"durs-network-documents 0.3.0",
"durs-wot 0.8.0-a0.9",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pbr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustbreak 2.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
"sqlite 0.23.9 (registry+https://github.com/rust-lang/crates.io-index)",
"threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "duniter-tui"
name = "durs-blockchain-dal"
version = "0.1.0-a0.1"
dependencies = [
"dubp-documents 0.11.0",
"duniter-conf 0.1.0-a0.1",
"duniter-dal 0.1.0-a0.1",
"duniter-message 0.1.0-a0.1",
"duniter-module 0.1.0-a0.1",
"duniter-network 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-network-documents 0.3.0",
"durs-wot 0.8.0-a0.9",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustbreak 2.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "dup-crypto"
version = "0.5.0"
name = "durs-message"
version = "0.1.0-a0.1"
dependencies = [
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto-wasm 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.11.0",
"duniter-module 0.1.0-a0.1",
"duniter-network 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-network-documents 0.3.0",
"serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "durs"
version = "0.1.0-a1"
dependencies = [
"duniter-core 0.1.0-a0.1",
"duniter-tui 0.1.0-a0.1",
"durs-ws2p 0.1.0-a0.1",
"durs-ws2p-v1-legacy 0.1.0-a0.1",
"structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
......@@ -426,16 +405,34 @@ name = "durs-skeleton"
version = "0.1.0"
dependencies = [
"duniter-conf 0.1.0-a0.1",
"duniter-dal 0.1.0-a0.1",
"duniter-message 0.1.0-a0.1",
"duniter-module 0.1.0-a0.1",
"duniter-network 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-message 0.1.0-a0.1",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "durs-tui"
version = "0.1.0-a0.1"
dependencies = [
"dubp-documents 0.11.0",
"duniter-conf 0.1.0-a0.1",
"duniter-module 0.1.0-a0.1",
"duniter-network 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-message 0.1.0-a0.1",
"durs-network-documents 0.3.0",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
......@@ -456,10 +453,10 @@ dependencies = [
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.11.0",
"duniter-conf 0.1.0-a0.1",
"duniter-message 0.1.0-a0.1",
"duniter-module 0.1.0-a0.1",
"duniter-network 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-message 0.1.0-a0.1",
"durs-network-documents 0.3.0",
"durs-ws2p-messages 0.1.0-a0.1",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -493,11 +490,10 @@ dependencies = [
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.11.0",
"duniter-conf 0.1.0-a0.1",
"duniter-dal 0.1.0-a0.1",
"duniter-message 0.1.0-a0.1",
"duniter-module 0.1.0-a0.1",
"duniter-network 0.1.0-a0.1",
"dup-crypto 0.5.0",
"durs-message 0.1.0-a0.1",
"durs-network-documents 0.3.0",
"durs-wot 0.8.0-a0.9",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
......
......@@ -6,14 +6,14 @@ members = [
"lib/core/message",
"lib/core/module",
"lib/core/network",
"lib/modules/blockchain",
"lib/modules/blockchain/blockchain",
"lib/modules/blockchain/blockchain-dal",
"lib/modules/skeleton",
"lib/modules/tui",
"lib/modules/ws2p-v1-legacy",
"lib/modules/ws2p/ws2p",
"lib/modules/ws2p/ws2p-messages",
"lib/tools/crypto",
"lib/tools/dal",
"lib/tools/documents",
"lib/tools/network-documents",
"lib/tools/wot",
......
......@@ -13,7 +13,7 @@ durs-ws2p-v1-legacy = { path = "../../lib/modules/ws2p-v1-legacy" }
structopt= "0.2.*"
[target.'cfg(unix)'.dependencies]
duniter-tui = { path = "../../lib/modules/tui" }
durs-tui = { path = "../../lib/modules/tui" }
[features]
ssl = ["durs-ws2p-v1-legacy/ssl"]
......
......@@ -32,7 +32,7 @@
extern crate duniter_core;
#[cfg(unix)]
extern crate duniter_tui;
extern crate durs_tui;
//extern crate durs_skeleton;
extern crate durs_ws2p_v1_legacy;
//extern crate durs_ws2p;
......@@ -40,7 +40,7 @@ extern crate structopt;
pub use duniter_core::{cli::DursOpt, DuRsConf, DuniterCore, UserCommand};
#[cfg(unix)]
pub use duniter_tui::TuiModule;
pub use durs_tui::TuiModule;
//pub use durs_skeleton::SkeletonModule;
pub use durs_ws2p_v1_legacy::WS2PModule;
//pub use durs_ws2p::WS2Pv2Module;
......
......@@ -10,10 +10,10 @@ path = "lib.rs"
[dependencies]
dirs = "1.0.2"
duniter-blockchain = { path = "../../modules/blockchain" }
durs-blockchain = { path = "../../modules/blockchain/blockchain" }
duniter-conf = { path = "../conf" }
dup-crypto = { path = "../../tools/crypto" }
duniter-message = { path = "../message" }
durs-message = { path = "../message" }
duniter-module = { path = "../module" }
duniter-network = { path = "../network" }
durs-network-documents = { path = "../../tools/network-documents" }
......
......@@ -34,12 +34,12 @@ extern crate log;
extern crate structopt;
extern crate dirs;
extern crate duniter_blockchain;
extern crate duniter_conf;
extern crate duniter_message;
extern crate duniter_module;
extern crate duniter_network;
extern crate dup_crypto;
extern crate durs_blockchain;
extern crate durs_message;
extern crate durs_network_documents;
extern crate log_panics;
extern crate serde_json;
......@@ -50,11 +50,11 @@ pub mod change_conf;
pub mod cli;
pub mod router;
use duniter_blockchain::{BlockchainModule, DBExQuery, DBExTxQuery, DBExWotQuery};
pub use duniter_conf::{ChangeGlobalConf, DuRsConf, DuniterKeyPairs, KEYPAIRS_FILENAME};
use duniter_message::*;
use duniter_module::*;
use duniter_network::{NetworkModule, SyncEndpoint, SyncParams};
use durs_blockchain::{BlockchainModule, DBExQuery, DBExTxQuery, DBExWotQuery};
use durs_message::*;
use log::Level;
use simplelog::*;
//use std::error::Error;
......@@ -229,7 +229,7 @@ impl<'a, 'b: 'a> DuniterCore<'b, 'a, DuRsConf> {
&mut self,
sup_apps: Vec<App<'a, 'b>>,
sup_apps_fn: Option<&Fn(&str, &ArgMatches) -> bool>,
external_followers: Vec<mpsc::Sender<DursMsgContent>>,
external_followers: Vec<mpsc::Sender<DursMsg>>,
) -> bool {
// Inject core subcommands
//let core_cli_conf = inject_core_subcommands(self.cli_conf.0.clone());
......
This diff is collapsed.
[package]
name = "duniter-message"
name = "durs-message"
version = "0.1.0-a0.1"
authors = ["librelois <elois@duniter.org>"]
description = "message model for the Duniter project."
authors = ["librelois <elois@ifee.fr>"]
description = "message model for the Durs project."
license = "AGPL-3.0"
[lib]
......@@ -10,7 +10,6 @@ path = "lib.rs"
[dependencies]
dup-crypto = { path = "../../tools/crypto" }
duniter-dal = { path = "../../tools/dal" }
dubp-documents= { path = "../../tools/documents" }
duniter-module = { path = "../module" }
duniter-network = { path = "../network" }
......
// Copyright (C) 2018 The Duniter Project Developers.
// Copyright (C) 2018 The Durs Project Developers.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -15,10 +15,25 @@
use dubp_documents::v10::block::BlockDocument;
use dubp_documents::*;
use duniter_network::events::NetworkEvent;
use *;
/// The DURS event message.
#[derive(Debug, Clone)]
pub enum DursEvent {
/// Arbitrary datas.
ArbitraryDatas(ArbitraryDatas),
/// Blockchain event
BlockchainEvent(BlockchainEvent),
/// Network event
NetworkEvent(NetworkEvent),
/// Client API event
ReceiveValidDocsFromClient(Vec<DUBPDocument>),
}
#[derive(Debug, Clone)]
/// Event to be transmitted to the other modules
pub enum DALEvent {
pub enum BlockchainEvent {
/// Stack up new valid block in local blockchain
StackUpValidBlock(Box<BlockDocument>, Blockstamp),
/// Revert blocks in local blockchain
......
// Copyright (C) 2018 The Duniter Project Developers.
// Copyright (C) 2018 The Durs Project Developers.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -13,8 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Defined the few global types used by all modules,
//! as well as the DuniterModule trait that all modules must implement.
//! Define the format of the messages exchanged between the DURS modules.
#![cfg_attr(feature = "strict", deny(warnings))]
#![deny(
......@@ -30,7 +29,6 @@
)]
extern crate dubp_documents;
extern crate duniter_dal;
extern crate duniter_module;
extern crate duniter_network;
extern crate dup_crypto;
......@@ -38,91 +36,71 @@ extern crate durs_network_documents;
extern crate serde;
extern crate serde_json;
use dubp_documents::BlockId;
use dubp_documents::DUBPDocument;
use duniter_dal::dal_event::DALEvent;
use duniter_dal::dal_requests::{DALRequest, DALResponse};
use duniter_module::*;
use duniter_network::{
events::NetworkEvent,
requests::{NetworkResponse, OldNetworkRequest},
};
use dup_crypto::hashs::Hash;
use dup_crypto::keys::Sig;
use durs_network_documents::network_endpoint::EndpointEnum;
#[derive(Debug, Clone)]
/// Message exchanged between Durs modules
pub struct DursMsg(pub DursMsgReceiver, pub DursMsgContent);
/// Define modules events
pub mod events;
impl ModuleMessage for DursMsg {}
/// Define modules requests
pub mod requests;
/// The recipient of a message
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum DursMsgReceiver {
/// Message for all modules
All,
/// Message for one specific module
One(ModuleStaticName),
/// Message for all modules who play a specific role
Role(ModuleRole),
/// Message for all modules that are subscribed to a specific type of event
Event(ModuleEvent),
}
/// Define requests responses
pub mod responses;
use events::*;
use requests::*;
use responses::*;
/// Message exchanged between Durs modules
#[derive(Debug, Clone)]
/// Content of message exchanged between Durs modules
pub enum DursMsgContent {
/// Request
Request(DursReq),
/// Brut text message
Text(String),
/// Brut binary message
Binary(Vec<u8>),
pub enum DursMsg {
/// Durs module event
Event {
/// Event type
event_type: ModuleEvent,
/// Event content
event_content: DursEvent,
},
/// Durs modules requests
Request {
/// The requester
req_from: ModuleStaticName,
/// Recipient
req_to: ModuleRole,
/// Request id (Must be unique for a given requester)
req_id: ModuleReqId,
/// Request content
req_content: DursReqContent,
},
/// Durs modules request response
Response {
/// The module that answers the request
res_from: ModuleStaticName,
/// The requester
res_to: ModuleStaticName,
/// Request id (Must be unique for a given requester)
req_id: ModuleReqId,
/// Response content
res_content: DursResContent,
},
/// Stop signal
Stop,
/// New configuration of a module to save
SaveNewModuleConf(ModuleStaticName, serde_json::Value),
/// List of local node endpoints
Endpoints(Vec<EndpointEnum>),
/// Response of DALRequest
DALResponse(Box<DALResponse>),
/// Blockchain event
DALEvent(DALEvent),
/// Request to the network module
OldNetworkRequest(OldNetworkRequest),
/// Network event
NetworkEvent(NetworkEvent),
/// Response of OldNetworkRequest
NetworkResponse(NetworkResponse),
/// Pow module response
ProverResponse(BlockId, Sig, u64),
/// Client API event
ReceiveDocsFromClient(Vec<DUBPDocument>),
/// Stop signal
Stop(),
/// List of all endpoints declared by the modules
ModulesEndpoints(Vec<EndpointEnum>),
}
#[derive(Debug, Clone)]
/// Durs modules requests
pub struct DursReq {
/// Requester
pub requester: ModuleStaticName,
/// Request unique id
pub id: ModuleReqId,
/// Request content
pub content: DursReqContent,
}
impl ModuleMessage for DursMsg {}
/// Arbitrary datas
#[derive(Debug, Clone)]
/// Modules request content
pub enum DursReqContent {
/// Network request (Not yet implemented)
NetworkRequest(),
/// Blockchain datas request
DALRequest(DALRequest),
/// Request to the pow module
ProverRequest(BlockId, Hash),
/// Brut text request
pub enum ArbitraryDatas {
/// Arbitrary text message
Text(String),
/// Brut binary request
/// Arbitrary json message
Json(serde_json::Value),
/// Arbitrary binary message
Binary(Vec<u8>),
}
// Copyright (C) 2018 The Durs Project Developers.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use dubp_documents::BlockId;
use duniter_network::requests::OldNetworkRequest;
use dup_crypto::hashs::Hash;
use dup_crypto::keys::*;
use *;
#[derive(Debug, Clone)]
/// Modules request content
pub enum DursReqContent {
/// Request to the old network module
OldNetworkRequest(OldNetworkRequest),
/// Network request (Not yet implemented)
NetworkRequest(),
/// Blockchain datas request
BlockchainRequest(BlockchainRequest),
/// Mem pool datas request
MemPoolRequest(MemPoolRequest),
/// Request to the pow module
ProverRequest(BlockId, Hash),
/// Arbitrary datas
ArbitraryDatas(ArbitraryDatas),
}
#[derive(Debug, Clone, PartialEq)]
/// Inter-module Blockchain request for blockchain data
pub enum BlockchainRequest {
/// Current block
CurrentBlock(),
/// Block by number
BlockByNumber(u64),
/// Chunk (block pack)
Chunk(u64, usize),
/// Usernames corresponding to the public keys in parameter
UIDs(Vec<PubKey>),
}
#[derive(Debug, Copy, Clone)]
/// Inter-module request for mem pool data
pub enum MemPoolRequest {
/// All pending identities with their pending certifications
AllPendingIdentities(usize),
/// All pending identities without their pending certifications
AllPendingIdentitiesWithoutCerts(usize),
/// All pending datas for given pubkey
PendingWotDatasForPubkey(PubKey),
}
// Copyright (C) 2018 The Duniter Project Developers.
// Copyright (C) 2018 The Durs Project Developers.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -13,51 +13,30 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
extern crate duniter_module;
extern crate serde;
use self::duniter_module::ModuleReqId;
use dubp_documents::v10::block::BlockDocument;
use dubp_documents::v10::certification::CertificationDocument;
use dubp_documents::v10::identity::IdentityDocument;
use dubp_documents::v10::membership::MembershipDocument;
use dubp_documents::v10::revocation::RevocationDocument;
use dubp_documents::BlockId;
use dubp_documents::Blockstamp;
use duniter_module::ModuleReqId;
use duniter_network::requests::NetworkResponse;
use dup_crypto::hashs::Hash;
use dup_crypto::keys::*;
use std::collections::HashMap;
#[derive(Debug, Copy, Clone)]
/// Inter-module DAL request for pool data
pub enum DALReqPendings {
/// All pending identities with their pending certifications
AllPendingIdentities(usize),
/// All pending identities without their pending certifications
AllPendingIdentitiesWithoutCerts(usize),
/// All pending datas for given pubkey
PendingWotDatasForPubkey(PubKey),
}
#[derive(Debug, Clone, PartialEq)]
/// Inter-module DAL request for blockchain data
pub enum DALReqBlockchain {
/// Current block
CurrentBlock(),
/// Block by number
BlockByNumber(u64),
/// Chunk (block pack)
Chunk(u64, usize),
/// Usernames corresponding to the public keys in parameter
UIDs(Vec<PubKey>),
}
/// Durs request response message
#[derive(Debug, Clone)]
/// Inter-module DAL request
pub enum DALRequest {
/// Inter-module DAL request for blockchain data
BlockchainRequest(DALReqBlockchain),
/// Inter-module DAL request for pool data
PendingsRequest(DALReqPendings),
pub enum DursResContent {
/// BlockchainResponse
BlockchainResponse(BlockchainResponse),
/// MemPoolResponse
MemPoolResponse(MemPoolResponse),
/// Response of OldNetworkRequest
NetworkResponse(NetworkResponse),
/// Pow module response
ProverResponse(BlockId, Sig, u64),
}
#[derive(Debug, Clone)]
......@@ -76,19 +55,8 @@ pub struct PendingIdtyDatas {
}
#[derive(Debug, Clone)]
/// Response to a DALReqPendings request
pub enum DALResPendings {
/// All pending identities with their pending certifications
AllPendingIdentities(ModuleReqId, HashMap<Hash, PendingIdtyDatas>),
/// All pending identities without their pending certifications
AllPendingIdentitiesWithoutCerts(ModuleReqId, HashMap<Hash, PendingIdtyDatas>),
/// All pending datas for given pubkey
PendingWotDatasForPubkey(ModuleReqId, Box<PendingIdtyDatas>),
}
#[derive(Debug, Clone)]
/// Response to a DALReqBlockchain request
pub enum DALResBlockchain {
/// Response to a BlockchainReqBlockchain request
pub enum BlockchainResponse {
/// Current block
CurrentBlock(ModuleReqId, Box<BlockDocument>, Blockstamp),
/// Block by number
......@@ -100,10 +68,12 @@ pub enum DALResBlockchain {
}
#[derive(Debug, Clone)]
/// Response to a DAL request
pub enum DALResponse {
/// Response to a DALReqBlockchain request
Blockchain(Box<DALResBlockchain>),
/// Response to a DALReqPendings request