Trait reth::rpc::api::AdminApiServer

source ·
pub trait AdminApiServer: Sized + Send + Sync + 'static {
    // Required methods
    fn add_peer(&self, record: NodeRecord) -> Result<bool, ErrorObject<'static>>;
    fn remove_peer(&self, record: AnyNode) -> Result<bool, ErrorObject<'static>>;
    fn add_trusted_peer(
        &self,
        record: AnyNode,
    ) -> Result<bool, ErrorObject<'static>>;
    fn remove_trusted_peer(
        &self,
        record: AnyNode,
    ) -> Result<bool, ErrorObject<'static>>;
    fn peers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>, ErrorObject<'static>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn node_info<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<NodeInfo, ErrorObject<'static>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn subscribe_peer_events<'life0, 'async_trait>(
        &'life0 self,
        subscription_sink: PendingSubscriptionSink,
    ) -> Pin<Box<dyn Future<Output = Result<(), StringError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn into_rpc(self) -> RpcModule<Self> { ... }
}
Expand description

Server trait implementation for the AdminApi RPC API.

Required Methods§

source

fn add_peer(&self, record: NodeRecord) -> Result<bool, ErrorObject<'static>>

Adds the given node record to the peerset.

source

fn remove_peer(&self, record: AnyNode) -> Result<bool, ErrorObject<'static>>

Disconnects from a remote node if the connection exists.

Returns true if the peer was successfully removed.

source

fn add_trusted_peer( &self, record: AnyNode, ) -> Result<bool, ErrorObject<'static>>

Adds the given node record to the trusted peerset.

source

fn remove_trusted_peer( &self, record: AnyNode, ) -> Result<bool, ErrorObject<'static>>

Removes a remote node from the trusted peer set, but it does not disconnect it automatically.

Returns true if the peer was successfully removed.

source

fn peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

The peers administrative property can be queried for all the information known about the connected remote nodes at the networking granularity. These include general information about the nodes themselves as participants of the devp2p P2P overlay protocol, as well as specialized information added by each of the running application protocols

source

fn node_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<NodeInfo, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the ENR of the node.

source

fn subscribe_peer_events<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, ) -> Pin<Box<dyn Future<Output = Result<(), StringError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Creates an RPC subscription which serves events received from the network.

Provided Methods§

source

fn into_rpc(self) -> RpcModule<Self>

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<N> AdminApiServer for AdminApi<N>
where N: NetworkInfo + Peers + 'static,

source§

fn add_peer(&self, record: NodeRecord) -> Result<bool, ErrorObject<'static>>

Handler for admin_addPeer

source§

fn remove_peer(&self, record: AnyNode) -> Result<bool, ErrorObject<'static>>

Handler for admin_removePeer

source§

fn add_trusted_peer( &self, record: AnyNode, ) -> Result<bool, ErrorObject<'static>>

Handler for admin_addTrustedPeer

source§

fn remove_trusted_peer( &self, record: AnyNode, ) -> Result<bool, ErrorObject<'static>>

Handler for admin_removeTrustedPeer

source§

fn peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, AdminApi<N>: 'async_trait,

Handler for admin_peers

source§

fn node_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<NodeInfo, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, AdminApi<N>: 'async_trait,

Handler for admin_nodeInfo

source§

fn subscribe_peer_events<'life0, 'async_trait>( &'life0 self, _pending: PendingSubscriptionSink, ) -> Pin<Box<dyn Future<Output = Result<(), StringError>> + Send + 'async_trait>>
where 'life0: 'async_trait, AdminApi<N>: 'async_trait,

Handler for admin_peerEvents

Implementors§