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§
Sourcefn add_peer(&self, record: NodeRecord) -> Result<bool, ErrorObject<'static>>
fn add_peer(&self, record: NodeRecord) -> Result<bool, ErrorObject<'static>>
Adds the given node record to the peerset.
Sourcefn remove_peer(&self, record: AnyNode) -> Result<bool, ErrorObject<'static>>
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.
Sourcefn add_trusted_peer(
&self,
record: AnyNode,
) -> Result<bool, ErrorObject<'static>>
fn add_trusted_peer( &self, record: AnyNode, ) -> Result<bool, ErrorObject<'static>>
Adds the given node record to the trusted peerset.
Sourcefn remove_trusted_peer(
&self,
record: AnyNode,
) -> Result<bool, ErrorObject<'static>>
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.
Sourcefn 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 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
Sourcefn 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 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.
Sourcefn 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,
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§
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.
Implementations on Foreign Types§
Source§impl<N, ChainSpec> AdminApiServer for AdminApi<N, ChainSpec>where
N: NetworkInfo + Peers + 'static,
ChainSpec: EthChainSpec + EthereumHardforks + Send + Sync + 'static,
impl<N, ChainSpec> AdminApiServer for AdminApi<N, ChainSpec>where
N: NetworkInfo + Peers + 'static,
ChainSpec: EthChainSpec + EthereumHardforks + Send + Sync + 'static,
Source§fn add_peer(&self, record: NodeRecord) -> Result<bool, ErrorObject<'static>>
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>>
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>>
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>>
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, ChainSpec>: 'async_trait,
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, ChainSpec>: 'async_trait,
Handler for admin_peers