pub struct FullNetworkConfiguration<B: BlockT + 'static, H: ExHashT, N: NetworkBackend<B, H>> {
pub network_config: NetworkConfiguration,
pub metrics_registry: Option<Registry>,
/* private fields */
}
Expand description
Full network configuration.
Fields§
§network_config: NetworkConfiguration
Network configuration.
metrics_registry: Option<Registry>
Registry for recording prometheus metrics to.
Implementations§
Source§impl<B: BlockT + 'static, H: ExHashT, N: NetworkBackend<B, H>> FullNetworkConfiguration<B, H, N>
impl<B: BlockT + 'static, H: ExHashT, N: NetworkBackend<B, H>> FullNetworkConfiguration<B, H, N>
Sourcepub fn new(
network_config: &NetworkConfiguration,
metrics_registry: Option<Registry>,
) -> Self
pub fn new( network_config: &NetworkConfiguration, metrics_registry: Option<Registry>, ) -> Self
Create new FullNetworkConfiguration
.
Sourcepub fn add_notification_protocol(
&mut self,
config: N::NotificationProtocolConfig,
)
pub fn add_notification_protocol( &mut self, config: N::NotificationProtocolConfig, )
Add a notification protocol.
Sourcepub fn notification_protocols(&self) -> &Vec<N::NotificationProtocolConfig>
pub fn notification_protocols(&self) -> &Vec<N::NotificationProtocolConfig>
Get reference to installed notification protocols.
Sourcepub fn add_request_response_protocol(
&mut self,
config: N::RequestResponseProtocolConfig,
)
pub fn add_request_response_protocol( &mut self, config: N::RequestResponseProtocolConfig, )
Add a request-response protocol.
Sourcepub fn peer_store_handle(&self) -> Arc<dyn PeerStoreProvider>
pub fn peer_store_handle(&self) -> Arc<dyn PeerStoreProvider>
Get handle to PeerStore
.
Sourcepub fn take_peer_store(&mut self) -> N::PeerStore
pub fn take_peer_store(&mut self) -> N::PeerStore
Take PeerStore
.
PeerStore
is created when FullNetworkConfig
is initialized so that PeerStoreHandle
s
can be passed onto notification protocols. PeerStore
itself should be started only once
and since technically it’s not a libp2p task, it should be started with SpawnHandle
in
builder.rs
instead of using the libp2p/litep2p executor in the networking backend. This
function consumes PeerStore
and starts its event loop in the appropriate place.
Sourcepub fn sanity_check_addresses(&self) -> Result<(), Error>
pub fn sanity_check_addresses(&self) -> Result<(), Error>
Verify addresses are consistent with enabled transports.
Sourcepub fn sanity_check_bootnodes(&self) -> Result<(), Error>
pub fn sanity_check_bootnodes(&self) -> Result<(), Error>
Check for duplicate bootnodes.
Sourcepub fn known_addresses(&self) -> Vec<(PeerId, Multiaddr)>
pub fn known_addresses(&self) -> Vec<(PeerId, Multiaddr)>
Collect all reserved nodes and bootnodes addresses.
Auto Trait Implementations§
impl<B, H, N> Freeze for FullNetworkConfiguration<B, H, N>
impl<B, H, N> !RefUnwindSafe for FullNetworkConfiguration<B, H, N>
impl<B, H, N> Send for FullNetworkConfiguration<B, H, N>where
<N as NetworkBackend<B, H>>::PeerStore: Send,
<N as NetworkBackend<B, H>>::NotificationProtocolConfig: Send,
<N as NetworkBackend<B, H>>::RequestResponseProtocolConfig: Send,
impl<B, H, N> Sync for FullNetworkConfiguration<B, H, N>where
<N as NetworkBackend<B, H>>::PeerStore: Sync,
<N as NetworkBackend<B, H>>::NotificationProtocolConfig: Sync,
<N as NetworkBackend<B, H>>::RequestResponseProtocolConfig: Sync,
impl<B, H, N> Unpin for FullNetworkConfiguration<B, H, N>where
<N as NetworkBackend<B, H>>::PeerStore: Unpin,
<N as NetworkBackend<B, H>>::NotificationProtocolConfig: Unpin,
<N as NetworkBackend<B, H>>::RequestResponseProtocolConfig: Unpin,
impl<B, H, N> !UnwindSafe for FullNetworkConfiguration<B, H, N>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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>
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 moreSource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.