Skip to main content

parsec/gossip/
messages.rs

1// Copyright 2018 MaidSafe.net limited.
2//
3// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
4// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
5// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6// KIND, either express or implied. Please review the Licences for the specific language governing
7// permissions and limitations relating to use of the SAFE Network Software.
8
9use crate::{gossip::packed_event::PackedEvent, id::PublicId, network_event::NetworkEvent};
10
11/// A gossip request message.
12#[serde(bound = "")]
13#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
14pub struct Request<T: NetworkEvent, P: PublicId> {
15    pub(crate) packed_events: Vec<PackedEvent<T, P>>,
16}
17
18impl<T: NetworkEvent, P: PublicId> Request<T, P> {
19    pub(crate) fn new(packed_events: Vec<PackedEvent<T, P>>) -> Self {
20        Self { packed_events }
21    }
22}
23
24/// A gossip response message.
25#[serde(bound = "")]
26#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
27pub struct Response<T: NetworkEvent, P: PublicId> {
28    pub(crate) packed_events: Vec<PackedEvent<T, P>>,
29}
30
31impl<T: NetworkEvent, P: PublicId> Response<T, P> {
32    pub(crate) fn new(packed_events: Vec<PackedEvent<T, P>>) -> Self {
33        Self { packed_events }
34    }
35}