Struct fuel_core_p2p::behavior::FuelBehaviour
source · pub struct FuelBehaviour { /* private fields */ }
Expand description
Handles all p2p protocols needed for Fuel.
Implementations§
source§impl FuelBehaviour
impl FuelBehaviour
pub fn add_addresses_to_discovery( &mut self, peer_id: &PeerId, addresses: Vec<Multiaddr>, )
pub fn publish_message( &mut self, topic: GossipTopic, encoded_data: Vec<u8>, ) -> Result<MessageId, PublishError>
pub fn send_request_msg( &mut self, message_request: RequestMessage, peer_id: &PeerId, ) -> OutboundRequestId
pub fn send_response_msg( &mut self, channel: ResponseChannel<ResponseMessage>, message: ResponseMessage, ) -> Result<(), ResponseMessage>
pub fn report_message_validation_result( &mut self, msg_id: &MessageId, propagation_source: &PeerId, acceptance: MessageAcceptance, ) -> Option<f64>
pub fn update_block_height(&mut self, block_height: BlockHeight)
pub fn block_peer(&mut self, peer_id: PeerId)
Trait Implementations§
source§impl NetworkBehaviour for FuelBehaviour
impl NetworkBehaviour for FuelBehaviour
§type ConnectionHandler = ConnectionHandlerSelect<ConnectionHandlerSelect<ConnectionHandlerSelect<ConnectionHandlerSelect<ConnectionHandlerSelect<ConnectionHandlerSelect<<Behaviour<BlockedPeers> as NetworkBehaviour>::ConnectionHandler, <Behaviour as NetworkBehaviour>::ConnectionHandler>, <Behaviour as NetworkBehaviour>::ConnectionHandler>, <Behaviour as NetworkBehaviour>::ConnectionHandler>, <Behaviour as NetworkBehaviour>::ConnectionHandler>, <Behaviour as NetworkBehaviour>::ConnectionHandler>, <Behaviour<PostcardCodec> as NetworkBehaviour>::ConnectionHandler>
type ConnectionHandler = ConnectionHandlerSelect<ConnectionHandlerSelect<ConnectionHandlerSelect<ConnectionHandlerSelect<ConnectionHandlerSelect<ConnectionHandlerSelect<<Behaviour<BlockedPeers> as NetworkBehaviour>::ConnectionHandler, <Behaviour as NetworkBehaviour>::ConnectionHandler>, <Behaviour as NetworkBehaviour>::ConnectionHandler>, <Behaviour as NetworkBehaviour>::ConnectionHandler>, <Behaviour as NetworkBehaviour>::ConnectionHandler>, <Behaviour as NetworkBehaviour>::ConnectionHandler>, <Behaviour<PostcardCodec> as NetworkBehaviour>::ConnectionHandler>
Handler for all the protocols the network behaviour supports.
§type ToSwarm = FuelBehaviourEvent
type ToSwarm = FuelBehaviourEvent
Event generated by the
NetworkBehaviour
and that the swarm will report back.source§fn handle_pending_inbound_connection(
&mut self,
connection_id: ConnectionId,
local_addr: &Multiaddr,
remote_addr: &Multiaddr,
) -> Result<(), ConnectionDenied>
fn handle_pending_inbound_connection( &mut self, connection_id: ConnectionId, local_addr: &Multiaddr, remote_addr: &Multiaddr, ) -> Result<(), ConnectionDenied>
Callback that is invoked for every new inbound connection. Read more
source§fn handle_established_inbound_connection(
&mut self,
connection_id: ConnectionId,
peer: PeerId,
local_addr: &Multiaddr,
remote_addr: &Multiaddr,
) -> Result<THandler<Self>, ConnectionDenied>
fn handle_established_inbound_connection( &mut self, connection_id: ConnectionId, peer: PeerId, local_addr: &Multiaddr, remote_addr: &Multiaddr, ) -> Result<THandler<Self>, ConnectionDenied>
Callback that is invoked for every established inbound connection. Read more
source§fn handle_pending_outbound_connection(
&mut self,
connection_id: ConnectionId,
maybe_peer: Option<PeerId>,
addresses: &[Multiaddr],
effective_role: Endpoint,
) -> Result<Vec<Multiaddr>, ConnectionDenied>
fn handle_pending_outbound_connection( &mut self, connection_id: ConnectionId, maybe_peer: Option<PeerId>, addresses: &[Multiaddr], effective_role: Endpoint, ) -> Result<Vec<Multiaddr>, ConnectionDenied>
Callback that is invoked for every outbound connection attempt. Read more
source§fn handle_established_outbound_connection(
&mut self,
connection_id: ConnectionId,
peer: PeerId,
addr: &Multiaddr,
role_override: Endpoint,
) -> Result<THandler<Self>, ConnectionDenied>
fn handle_established_outbound_connection( &mut self, connection_id: ConnectionId, peer: PeerId, addr: &Multiaddr, role_override: Endpoint, ) -> Result<THandler<Self>, ConnectionDenied>
Callback that is invoked for every established outbound connection. Read more
source§fn on_connection_handler_event(
&mut self,
peer_id: PeerId,
connection_id: ConnectionId,
event: THandlerOutEvent<Self>,
)
fn on_connection_handler_event( &mut self, peer_id: PeerId, connection_id: ConnectionId, event: THandlerOutEvent<Self>, )
Informs the behaviour about an event generated by the
ConnectionHandler
dedicated to the peer identified by peer_id
. for the behaviour. Read moresource§fn poll(
&mut self,
cx: &mut Context<'_>,
) -> Poll<ToSwarm<Self::ToSwarm, THandlerInEvent<Self>>>
fn poll( &mut self, cx: &mut Context<'_>, ) -> Poll<ToSwarm<Self::ToSwarm, THandlerInEvent<Self>>>
Polls for things that swarm should do. Read more
source§fn on_swarm_event(&mut self, event: FromSwarm<'_>)
fn on_swarm_event(&mut self, event: FromSwarm<'_>)
Informs the behaviour about an event from the
Swarm
.Auto Trait Implementations§
impl Freeze for FuelBehaviour
impl !RefUnwindSafe for FuelBehaviour
impl Send for FuelBehaviour
impl !Sync for FuelBehaviour
impl Unpin for FuelBehaviour
impl !UnwindSafe for FuelBehaviour
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<S> IteratorOverTable for S
impl<S> IteratorOverTable for S
source§fn iter_all<M>(
&self,
direction: Option<IterDirection>,
) -> BoxedIter<'_, Result<(<M as Mappable>::OwnedKey, <M as Mappable>::OwnedValue), Error>>where
M: Mappable,
Self: IterableTable<M>,
fn iter_all<M>(
&self,
direction: Option<IterDirection>,
) -> BoxedIter<'_, Result<(<M as Mappable>::OwnedKey, <M as Mappable>::OwnedValue), Error>>where
M: Mappable,
Self: IterableTable<M>,
Returns an iterator over the all entries in the table.
source§fn iter_all_by_prefix<M, P>(
&self,
prefix: Option<P>,
) -> BoxedIter<'_, Result<(<M as Mappable>::OwnedKey, <M as Mappable>::OwnedValue), Error>>
fn iter_all_by_prefix<M, P>( &self, prefix: Option<P>, ) -> BoxedIter<'_, Result<(<M as Mappable>::OwnedKey, <M as Mappable>::OwnedValue), Error>>
Returns an iterator over the all entries in the table with the specified prefix.
source§fn iter_all_by_start<M>(
&self,
start: Option<&<M as Mappable>::Key>,
direction: Option<IterDirection>,
) -> BoxedIter<'_, Result<(<M as Mappable>::OwnedKey, <M as Mappable>::OwnedValue), Error>>where
M: Mappable,
Self: IterableTable<M>,
fn iter_all_by_start<M>(
&self,
start: Option<&<M as Mappable>::Key>,
direction: Option<IterDirection>,
) -> BoxedIter<'_, Result<(<M as Mappable>::OwnedKey, <M as Mappable>::OwnedValue), Error>>where
M: Mappable,
Self: IterableTable<M>,
Returns an iterator over the all entries in the table after a specific start key.
source§fn iter_all_filtered<M, P>(
&self,
prefix: Option<P>,
start: Option<&<M as Mappable>::Key>,
direction: Option<IterDirection>,
) -> BoxedIter<'_, Result<(<M as Mappable>::OwnedKey, <M as Mappable>::OwnedValue), Error>>
fn iter_all_filtered<M, P>( &self, prefix: Option<P>, start: Option<&<M as Mappable>::Key>, direction: Option<IterDirection>, ) -> BoxedIter<'_, Result<(<M as Mappable>::OwnedKey, <M as Mappable>::OwnedValue), Error>>
Returns an iterator over the all entries in the table with a prefix after a specific start key.