From d1c816660c0583db33d160e2ef3e980bef0d5a85 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Mon, 27 May 2024 00:59:23 +0200 Subject: p2p: WIP rpc server implementation for the p2p monitor --- p2p/src/monitor.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'p2p/src/monitor.rs') diff --git a/p2p/src/monitor.rs b/p2p/src/monitor.rs index b7afb7c..4d6a46c 100644 --- a/p2p/src/monitor.rs +++ b/p2p/src/monitor.rs @@ -4,6 +4,9 @@ use karyon_core::event::{ArcEventSys, EventListener, EventSys, EventValue, Event use karyon_net::Endpoint; +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; + use crate::{Config, PeerID}; /// Responsible for network and system monitoring. @@ -37,7 +40,6 @@ use crate::{Config, PeerID}; /// ``` pub struct Monitor { event_sys: ArcEventSys, - config: Arc, } @@ -77,6 +79,7 @@ impl Monitor { } #[derive(Clone, Debug, Eq, PartialEq, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum MonitorTopic { Conn, PeerPool, @@ -85,6 +88,7 @@ pub enum MonitorTopic { /// Defines connection-related events. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum ConnEvent { Connected(Endpoint), ConnectRetried(Endpoint), @@ -98,6 +102,7 @@ pub enum ConnEvent { /// Defines `PeerPool` events. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum PeerPoolEvent { NewPeer(PeerID), RemovePeer(PeerID), @@ -105,6 +110,7 @@ pub enum PeerPoolEvent { /// Defines `Discovery` events. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum DiscoveryEvent { LookupStarted(Endpoint), LookupFailed(Endpoint), -- cgit v1.2.3