fuel_core_p2p::service

Trait TaskP2PService

Source
pub trait TaskP2PService: Send {
    // Required methods
    fn get_all_peer_info(&self) -> Vec<(&PeerId, &PeerInfo)>;
    fn get_peer_id_with_height(&self, height: &BlockHeight) -> Option<PeerId>;
    fn next_event(&mut self) -> BoxFuture<'_, Option<FuelP2PEvent>>;
    fn publish_message(
        &mut self,
        message: GossipsubBroadcastRequest,
    ) -> Result<()>;
    fn send_request_msg(
        &mut self,
        peer_id: Option<PeerId>,
        request_msg: RequestMessage,
        on_response: ResponseSender,
    ) -> Result<()>;
    fn send_response_msg(
        &mut self,
        request_id: InboundRequestId,
        message: ResponseMessage,
    ) -> Result<()>;
    fn report_message(
        &mut self,
        message: GossipsubMessageInfo,
        acceptance: GossipsubMessageAcceptance,
    ) -> Result<()>;
    fn report_peer(
        &mut self,
        peer_id: PeerId,
        score: AppScore,
        reporting_service: &str,
    ) -> Result<()>;
    fn update_block_height(&mut self, height: BlockHeight) -> Result<()>;
    fn update_metrics<T>(&self, update_fn: T)
       where T: FnOnce();
}

Required Methods§

Source

fn get_all_peer_info(&self) -> Vec<(&PeerId, &PeerInfo)>

Source

fn get_peer_id_with_height(&self, height: &BlockHeight) -> Option<PeerId>

Source

fn next_event(&mut self) -> BoxFuture<'_, Option<FuelP2PEvent>>

Source

fn publish_message(&mut self, message: GossipsubBroadcastRequest) -> Result<()>

Source

fn send_request_msg( &mut self, peer_id: Option<PeerId>, request_msg: RequestMessage, on_response: ResponseSender, ) -> Result<()>

Source

fn send_response_msg( &mut self, request_id: InboundRequestId, message: ResponseMessage, ) -> Result<()>

Source

fn report_message( &mut self, message: GossipsubMessageInfo, acceptance: GossipsubMessageAcceptance, ) -> Result<()>

Source

fn report_peer( &mut self, peer_id: PeerId, score: AppScore, reporting_service: &str, ) -> Result<()>

Source

fn update_block_height(&mut self, height: BlockHeight) -> Result<()>

Source

fn update_metrics<T>(&self, update_fn: T)
where T: FnOnce(),

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§