reth_rpc_api::servers

Trait AdminApiServer

Source
pub trait AdminApiServer:
    Sized
    + Send
    + Sync
    + 'static {
    // Required methods
    fn add_peer(&self, record: NodeRecord) -> RpcResult<bool>;
    fn remove_peer(&self, record: AnyNode) -> RpcResult<bool>;
    fn add_trusted_peer(&self, record: AnyNode) -> RpcResult<bool>;
    fn remove_trusted_peer(&self, record: AnyNode) -> RpcResult<bool>;
    fn peers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = RpcResult<Vec<PeerInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn node_info<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = RpcResult<NodeInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe_peer_events<'life0, 'async_trait>(
        &'life0 self,
        subscription_sink: PendingSubscriptionSink,
    ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: '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) -> RpcResult<bool>

Adds the given node record to the peerset.

Source

fn remove_peer(&self, record: AnyNode) -> RpcResult<bool>

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) -> RpcResult<bool>

Adds the given node record to the trusted peerset.

Source

fn remove_trusted_peer(&self, record: AnyNode) -> RpcResult<bool>

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 = RpcResult<Vec<PeerInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: '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 = RpcResult<NodeInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: '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 = SubscriptionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: '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.

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§