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

[enh] #68 add message crate

parent bebb7c10
No related branches found
No related tags found
1 merge request!58Resolve "Add crates blockchain, conf, core, dal, message, module, network, tui and ws2p"
[package]
name = "duniter-message"
version = "0.1.0"
authors = ["librelois <elois@duniter.org>"]
description = "message model for the Duniter project."
license = "AGPL-3.0"
[lib]
path = "lib.rs"
[dependencies]
duniter-crypto = { path = "../crypto" }
duniter-dal = { path = "../dal" }
duniter-documents = { path = "../documents" }
duniter-module = { path = "../module" }
duniter-network = { path = "../network" }
serde = "1.0.24"
serde_derive = "1.0.24"
serde_json = "1.0.9"
\ No newline at end of file
// Copyright (C) 2018 The Duniter 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/>.
//! Defined the few global types used by all modules,
//! as well as the DuniterModule trait that all modules must implement.
#![cfg_attr(feature = "strict", deny(warnings))]
#![deny(
missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts,
trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces,
unused_qualifications
)]
extern crate duniter_crypto;
extern crate duniter_dal;
extern crate duniter_documents;
extern crate duniter_module;
extern crate duniter_network;
extern crate serde;
extern crate serde_json;
use std::sync::mpsc;
use duniter_crypto::keys::ed25519;
use duniter_dal::dal_event::DALEvent;
use duniter_dal::dal_requests::{DALRequest, DALResponse};
use duniter_documents::blockchain::BlockchainProtocol;
use duniter_documents::{BlockId, Hash};
use duniter_module::ModuleMessage;
use duniter_network::{NetworkEvent, NetworkRequest};
#[derive(Debug, Clone)]
/// Message exchanged between Duniter-rs modules
pub enum DuniterMessage {
/// Brut text message
Text(String),
/// Brut json message
Json(serde_json::Value),
/// Brut binary message
Binary(Vec<u8>),
/// Subscriptions to the module feed
Followers(Vec<mpsc::Sender<DuniterMessage>>),
/// Blockchain datas request
DALRequest(DALRequest),
/// Response of DALRequest
DALResponse(DALResponse),
/// Blockchain event
DALEvent(DALEvent),
/// Request to the network module
NetworkRequest(NetworkRequest),
/// Network event
NetworkEvent(NetworkEvent),
/// Request to the pow module
ProverRequest(BlockId, Hash),
/// Pow module response
ProverResponse(BlockId, ed25519::Signature, u64),
/// Client API event
ReceiveDocsFromClient(Vec<BlockchainProtocol>),
/// Stop signal
Stop(),
}
impl ModuleMessage for DuniterMessage {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment