pub enum P2pNetworkPubsubAction {
Show 22 variants
NewStream {
incoming: bool,
peer_id: PeerId,
addr: ConnectionAddr,
stream_id: u32,
protocol: BroadcastAlgorithm,
},
IncomingData {
peer_id: PeerId,
addr: ConnectionAddr,
stream_id: u32,
data: Data,
seen_limit: usize,
},
ValidateIncomingMessages {
peer_id: PeerId,
seen_limit: usize,
addr: ConnectionAddr,
},
IncomingMessage {
peer_id: PeerId,
message: Message,
seen_limit: usize,
},
IncomingMessageCleanup {
peer_id: PeerId,
},
Graft {
peer_id: PeerId,
topic_id: String,
},
Prune {
peer_id: PeerId,
topic_id: String,
},
WebRtcRebroadcast {
message: GossipNetMessageV2,
},
Broadcast {
message: GossipNetMessageV2,
},
Sign {
seqno: u64,
author: PeerId,
data: Data,
topic: String,
},
SignError {
author: PeerId,
topic: String,
},
BroadcastSigned {
signature: Data,
},
OutgoingMessage {
peer_id: PeerId,
},
OutgoingMessageClear {
peer_id: PeerId,
},
OutgoingMessageError {
msg: Rpc,
peer_id: PeerId,
},
OutgoingData {
data: Data,
peer_id: PeerId,
},
HandleIncomingMessage {
message: Message,
message_content: GossipNetMessageV2,
peer_id: PeerId,
},
ValidateIncomingMessage {
message_id: P2pNetworkPubsubMessageCacheId,
},
PruneMessages {},
RejectMessage {
message_id: Option<BroadcastMessageId>,
peer_id: Option<PeerId>,
reason: String,
},
IgnoreMessage {
message_id: Option<BroadcastMessageId>,
reason: String,
},
BroadcastValidatedMessage {
message_id: BroadcastMessageId,
},
}
Expand description
Actions that can occur within the P2P Network PubSub system.
Managing pubsub streams, handling incoming and outgoing messages, and maintaining the mesh network topology.
Common Fields:
peer_id
: The identifier of the peer associated with the action.addr
: The connection address of the peer.stream_id
: The unique identifier of the stream.topic_id
: The identifier of the topic involved in the action.
Variants§
NewStream
Create a new stream, either incoming or outgoing.
Fields:
incoming
: Indicates if the stream is incoming (true
) or outgoing (false
).protocol
: The broadcast algorithm used for the stream.
IncomingData
Process incoming raw data from a peer.
Fields:
data
: The raw data payload received.seen_limit
: The limit for tracking seen messages to prevent duplication.
ValidateIncomingMessages
Validate a batch of decoded incoming messages.
IncomingMessage
Handle a fully decoded and validated message received from a peer.
Fields:
message
: The decoded protobuf message.seen_limit
: The limit for tracking seen messages to prevent duplication.
IncomingMessageCleanup
Clean up temporary states after processing an incoming message.
Graft
Add a peer to the mesh network for a specific topic.
Prune
Remove a peer from the mesh network for a specific topic.
WebRtcRebroadcast
Rebroadcast message received from WebRTC connection.
Expected to be dispatched after the message has been processed, in spite of whether it was received from libp2p or webrtc network.
If received from libp2p network, or if we have already broadcasted
this message, the message will be in the mcache
state,
in which case the action won’t be enabled (will be filtered out).
Fields
message: GossipNetMessageV2
Broadcast
Initiate the broadcasting of a message to all subscribed peers.
Fields:
message
: The gossip network message to broadcast.
Fields
message: GossipNetMessageV2
Sign
Prepare a message for signing before broadcasting.
Fields:
seqno
: The sequence number of the message.author
: The identifier of the peer authoring the message.data
: The data payload of the message.topic
: The topic under which the message is published.
SignError
An error occured during the signing process.
BroadcastSigned
Finalize the broadcasting of a signed message by attaching the signature.
Fields:
signature
: The cryptographic signature of the message.
OutgoingMessage
Prepare an outgoing message to send to a specific peer.
OutgoingMessageClear
Clear the outgoing message state for a specific peer after sending.
OutgoingMessageError
An error occured during the sending of an outgoing message.
Fields:
msg
: The protobuf message that failed to send.
OutgoingData
Send encoded data over an outgoing stream to a specific peer.
Fields:
data
: The encoded data to be sent.
HandleIncomingMessage
ValidateIncomingMessage
Fields
message_id: P2pNetworkPubsubMessageCacheId
PruneMessages
Delete expired messages from state
RejectMessage
IgnoreMessage
BroadcastValidatedMessage
Fields
message_id: BroadcastMessageId
Trait Implementations§
Source§impl ActionEvent for P2pNetworkPubsubAction
impl ActionEvent for P2pNetworkPubsubAction
fn action_event<T>(&self, context: &T)where
T: EventContext,
Source§impl ActionKindGet for P2pNetworkPubsubAction
impl ActionKindGet for P2pNetworkPubsubAction
fn kind(&self) -> ActionKind
Source§impl Clone for P2pNetworkPubsubAction
impl Clone for P2pNetworkPubsubAction
Source§fn clone(&self) -> P2pNetworkPubsubAction
fn clone(&self) -> P2pNetworkPubsubAction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for P2pNetworkPubsubAction
impl Debug for P2pNetworkPubsubAction
Source§impl<'de> Deserialize<'de> for P2pNetworkPubsubAction
impl<'de> Deserialize<'de> for P2pNetworkPubsubAction
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<P2pNetworkPubsubAction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<P2pNetworkPubsubAction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl EnablingCondition<P2pState> for P2pNetworkPubsubAction
impl EnablingCondition<P2pState> for P2pNetworkPubsubAction
Source§impl EnablingCondition<State> for P2pNetworkPubsubAction
impl EnablingCondition<State> for P2pNetworkPubsubAction
Source§impl From<P2pNetworkPubsubAction> for Action
impl From<P2pNetworkPubsubAction> for Action
Source§fn from(value: P2pNetworkPubsubAction) -> Self
fn from(value: P2pNetworkPubsubAction) -> Self
Source§impl From<P2pNetworkPubsubAction> for P2pAction
impl From<P2pNetworkPubsubAction> for P2pAction
Source§fn from(value: P2pNetworkPubsubAction) -> P2pAction
fn from(value: P2pNetworkPubsubAction) -> P2pAction
Source§impl From<P2pNetworkPubsubAction> for P2pNetworkAction
impl From<P2pNetworkPubsubAction> for P2pNetworkAction
Source§fn from(original: P2pNetworkPubsubAction) -> P2pNetworkAction
fn from(original: P2pNetworkPubsubAction) -> P2pNetworkAction
Source§impl Serialize for P2pNetworkPubsubAction
impl Serialize for P2pNetworkPubsubAction
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for P2pNetworkPubsubAction
impl RefUnwindSafe for P2pNetworkPubsubAction
impl Send for P2pNetworkPubsubAction
impl Sync for P2pNetworkPubsubAction
impl Unpin for P2pNetworkPubsubAction
impl UnwindSafe for P2pNetworkPubsubAction
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.