#[non_exhaustive]pub struct NoopNetwork<Net = EthNetworkPrimitives> { /* private fields */ }Expand description
A type that implements all network trait that does nothing.
Intended for testing purposes where network is not used.
Implementations§
Source§impl<Net> NoopNetwork<Net>
impl<Net> NoopNetwork<Net>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new NoopNetwork.
Sourcepub const fn with_chain_id(self, chain_id: u64) -> Self
pub const fn with_chain_id(self, chain_id: u64) -> Self
Creates a new NoopNetwork from an existing one but with a new chain id.
Sourcepub fn with_client_version(self, client_version: impl Into<String>) -> Self
pub fn with_client_version(self, client_version: impl Into<String>) -> Self
Configures the client version returned by NetworkInfo::network_status.
Trait Implementations§
Source§impl<Net> BlockDownloaderProvider for NoopNetwork<Net>where
Net: NetworkPrimitives,
impl<Net> BlockDownloaderProvider for NoopNetwork<Net>where
Net: NetworkPrimitives,
Source§async fn fetch_client(&self) -> Result<Self::Client, RecvError>
async fn fetch_client(&self) -> Result<Self::Client, RecvError>
Returns a new
BlockClient, used for fetching blocks from peers. Read moreSource§impl<Net: Clone> Clone for NoopNetwork<Net>
impl<Net: Clone> Clone for NoopNetwork<Net>
Source§impl<Net: Debug> Debug for NoopNetwork<Net>
impl<Net: Debug> Debug for NoopNetwork<Net>
Source§impl Default for NoopNetwork<EthNetworkPrimitives>
impl Default for NoopNetwork<EthNetworkPrimitives>
Source§impl<Net> NetworkEventListenerProvider for NoopNetwork<Net>where
Net: NetworkPrimitives,
impl<Net> NetworkEventListenerProvider for NoopNetwork<Net>where
Net: NetworkPrimitives,
Source§type Primitives = Net
type Primitives = Net
The primitive types to use in the
PeerRequest used in the stream.Source§fn event_listener(
&self,
) -> EventStream<NetworkEvent<PeerRequest<Self::Primitives>>>
fn event_listener( &self, ) -> EventStream<NetworkEvent<PeerRequest<Self::Primitives>>>
Creates a new
NetworkEvent listener channel.Source§fn discovery_listener(&self) -> UnboundedReceiverStream<DiscoveryEvent>
fn discovery_listener(&self) -> UnboundedReceiverStream<DiscoveryEvent>
Returns a new
DiscoveryEvent stream. Read moreSource§impl<Net> NetworkInfo for NoopNetwork<Net>
impl<Net> NetworkInfo for NoopNetwork<Net>
Source§fn local_addr(&self) -> SocketAddr
fn local_addr(&self) -> SocketAddr
Returns the
SocketAddr that listens for incoming connections.Source§async fn network_status(&self) -> Result<NetworkStatus, NetworkError>
async fn network_status(&self) -> Result<NetworkStatus, NetworkError>
Returns the current status of the network being ran by the local node.
Source§fn cell_custody(&self) -> &CellCustody
fn cell_custody(&self) -> &CellCustody
Source§fn is_syncing(&self) -> bool
fn is_syncing(&self) -> bool
Returns
true if the network is undergoing sync.Source§fn is_initially_syncing(&self) -> bool
fn is_initially_syncing(&self) -> bool
Returns
true when the node is undergoing the very first Pipeline sync.Source§impl<Net> NetworkPeersEvents for NoopNetwork<Net>where
Net: NetworkPrimitives,
impl<Net> NetworkPeersEvents for NoopNetwork<Net>where
Net: NetworkPrimitives,
Source§fn peer_events(&self) -> PeerEventStream
fn peer_events(&self) -> PeerEventStream
Creates a new peer event listener stream.
Source§impl<Net> NetworkSyncUpdater for NoopNetwork<Net>
impl<Net> NetworkSyncUpdater for NoopNetwork<Net>
Source§fn update_status(&self, _head: Head)
fn update_status(&self, _head: Head)
Updates the status of the p2p node.
Source§fn update_sync_state(&self, _state: SyncState)
fn update_sync_state(&self, _state: SyncState)
Notifies about a [
SyncState] update.Source§fn update_block_range(&self, _: BlockRangeUpdate)
fn update_block_range(&self, _: BlockRangeUpdate)
Updates the advertised block range.
§fn set_fork_filter(&self, fork_filter: ForkFilter)
fn set_fork_filter(&self, fork_filter: ForkFilter)
Replaces the node’s active [
ForkFilter] to adopt a fork schedule that changed at runtime
(e.g. an L1-signalled upgrade) without a restart. Read moreSource§impl<Net> Peers for NoopNetwork<Net>
impl<Net> Peers for NoopNetwork<Net>
Source§fn add_peer_kind(
&self,
_peer: PeerId,
_kind: Option<PeerKind>,
_tcp_addr: SocketAddr,
_udp_addr: Option<SocketAddr>,
)
fn add_peer_kind( &self, _peer: PeerId, _kind: Option<PeerKind>, _tcp_addr: SocketAddr, _udp_addr: Option<SocketAddr>, )
Adds a peer to the known peer set, with the given kind. Read more
Source§async fn get_peers_by_kind(
&self,
_kind: PeerKind,
) -> Result<Vec<PeerInfo>, NetworkError>
async fn get_peers_by_kind( &self, _kind: PeerKind, ) -> Result<Vec<PeerInfo>, NetworkError>
Returns the rpc
PeerInfo for all connected peers with the given kind.Source§async fn get_all_peers(&self) -> Result<Vec<PeerInfo>, NetworkError>
async fn get_all_peers(&self) -> Result<Vec<PeerInfo>, NetworkError>
Returns the rpc
PeerInfo for all connected peers.Source§async fn get_peer_by_id(
&self,
_peer_id: PeerId,
) -> Result<Option<PeerInfo>, NetworkError>
async fn get_peer_by_id( &self, _peer_id: PeerId, ) -> Result<Option<PeerInfo>, NetworkError>
Source§async fn get_peers_by_id(
&self,
_peer_id: Vec<PeerId>,
) -> Result<Vec<PeerInfo>, NetworkError>
async fn get_peers_by_id( &self, _peer_id: Vec<PeerId>, ) -> Result<Vec<PeerInfo>, NetworkError>
Source§fn remove_peer(&self, _peer: PeerId, _kind: PeerKind)
fn remove_peer(&self, _peer: PeerId, _kind: PeerKind)
Removes a peer from the peer set that corresponds to given kind.
Source§fn disconnect_peer(&self, _peer: PeerId)
fn disconnect_peer(&self, _peer: PeerId)
Disconnect an existing connection to the given peer.
Source§fn disconnect_peer_with_reason(&self, _peer: PeerId, _reason: DisconnectReason)
fn disconnect_peer_with_reason(&self, _peer: PeerId, _reason: DisconnectReason)
Disconnect an existing connection to the given peer using the provided reason
Source§fn ban_peer(&self, _peer: PeerId)
fn ban_peer(&self, _peer: PeerId)
Bans the given peer and disconnects an active non-trusted session if one exists.
Source§fn unban_peer(&self, _peer: PeerId)
fn unban_peer(&self, _peer: PeerId)
Unbans the given peer.
Source§fn connect_peer_kind(
&self,
_peer: PeerId,
_kind: PeerKind,
_tcp_addr: SocketAddr,
_udp_addr: Option<SocketAddr>,
)
fn connect_peer_kind( &self, _peer: PeerId, _kind: PeerKind, _tcp_addr: SocketAddr, _udp_addr: Option<SocketAddr>, )
Connects a peer to the known peer set, with the given kind.
Source§fn reputation_change(&self, _peer_id: PeerId, _kind: ReputationChangeKind)
fn reputation_change(&self, _peer_id: PeerId, _kind: ReputationChangeKind)
Send a reputation change for the given peer.
Source§async fn reputation_by_id(
&self,
_peer_id: PeerId,
) -> Result<Option<Reputation>, NetworkError>
async fn reputation_by_id( &self, _peer_id: PeerId, ) -> Result<Option<Reputation>, NetworkError>
Get the reputation of a peer.
Source§fn add_peer(&self, peer: PeerId, tcp_addr: SocketAddr)
fn add_peer(&self, peer: PeerId, tcp_addr: SocketAddr)
Adds a peer to the peer set with TCP
SocketAddr. Read moreSource§fn add_peer_with_udp(
&self,
peer: PeerId,
tcp_addr: SocketAddr,
udp_addr: SocketAddr,
)
fn add_peer_with_udp( &self, peer: PeerId, tcp_addr: SocketAddr, udp_addr: SocketAddr, )
Adds a peer to the peer set with TCP and UDP
SocketAddr. Read moreSource§fn add_trusted_peer(&self, peer: PeerId, tcp_addr: SocketAddr)
fn add_trusted_peer(&self, peer: PeerId, tcp_addr: SocketAddr)
Adds a trusted peer to the peer set with TCP
SocketAddr.Source§fn add_trusted_peer_with_udp(
&self,
peer: PeerId,
tcp_addr: SocketAddr,
udp_addr: SocketAddr,
)
fn add_trusted_peer_with_udp( &self, peer: PeerId, tcp_addr: SocketAddr, udp_addr: SocketAddr, )
Adds a trusted peer with TCP and UDP
SocketAddr to the peer set.Source§fn add_trusted_peer_node(&self, _peer: TrustedPeer)
fn add_trusted_peer_node(&self, _peer: TrustedPeer)
Registers a trusted peer that may use a hostname instead of an IP address. Read more
Source§fn get_trusted_peers(
&self,
) -> impl Future<Output = Result<Vec<PeerInfo>, NetworkError>> + Send
fn get_trusted_peers( &self, ) -> impl Future<Output = Result<Vec<PeerInfo>, NetworkError>> + Send
Returns the rpc
PeerInfo for all connected PeerKind::Trusted peers.Source§fn get_basic_peers(
&self,
) -> impl Future<Output = Result<Vec<PeerInfo>, NetworkError>> + Send
fn get_basic_peers( &self, ) -> impl Future<Output = Result<Vec<PeerInfo>, NetworkError>> + Send
Returns the rpc
PeerInfo for all connected PeerKind::Basic peers.Source§fn connect_peer(&self, peer: PeerId, tcp_addr: SocketAddr)
fn connect_peer(&self, peer: PeerId, tcp_addr: SocketAddr)
Connect to the given peer. NOTE: if the maximum number of outbound sessions is reached,
this won’t do anything. See
reth_network::SessionManager::dial_outbound.Source§impl<Net> PeersHandleProvider for NoopNetwork<Net>where
Net: NetworkPrimitives,
impl<Net> PeersHandleProvider for NoopNetwork<Net>where
Net: NetworkPrimitives,
Source§fn peers_handle(&self) -> &PeersHandle
fn peers_handle(&self) -> &PeersHandle
Returns the
PeersHandle that can be cloned and shared. Read moreSource§impl<Net> PeersInfo for NoopNetwork<Net>
impl<Net> PeersInfo for NoopNetwork<Net>
Source§fn num_connected_peers(&self) -> usize
fn num_connected_peers(&self) -> usize
Returns how many peers the network is currently connected to. Read more
Source§fn local_node_record(&self) -> NodeRecord
fn local_node_record(&self) -> NodeRecord
Returns the Ethereum Node Record of the node.
Auto Trait Implementations§
impl<Net> Freeze for NoopNetwork<Net>where
PhantomData<Net>: Freeze,
impl<Net> RefUnwindSafe for NoopNetwork<Net>where
PhantomData<Net>: RefUnwindSafe,
impl<Net> Send for NoopNetwork<Net>where
PhantomData<Net>: Send,
impl<Net> Sync for NoopNetwork<Net>where
PhantomData<Net>: Sync,
impl<Net> Unpin for NoopNetwork<Net>where
PhantomData<Net>: Unpin,
impl<Net> UnsafeUnpin for NoopNetwork<Net>where
PhantomData<Net>: UnsafeUnpin,
impl<Net> UnwindSafe for NoopNetwork<Net>where
PhantomData<Net>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> FullNetwork for Twhere
T: BlockDownloaderProvider + NetworkSyncUpdater + NetworkInfo + NetworkEventListenerProvider + Peers + PeersHandleProvider + Clone + Unpin,
<T as BlockDownloaderProvider>::Client: BlockClient<Block = <<T as NetworkEventListenerProvider>::Primitives as NetworkPrimitives>::Block>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreimpl<T> MaybeDebug for Twhere
T: Debug,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes