Struct sc_network::config::NonDefaultSetConfig
source · pub struct NonDefaultSetConfig {
pub notifications_protocol: ProtocolName,
pub fallback_names: Vec<ProtocolName>,
pub handshake: Option<NotificationHandshake>,
pub max_notification_size: u64,
pub set_config: SetConfig,
}
Expand description
Extension to SetConfig
for sets that aren’t the default set.
Note: As new fields might be added in the future, please consider using the
new
method and modifiers instead of creating this struct manually.
Fields§
§notifications_protocol: ProtocolName
Name of the notifications protocols of this set. A substream on this set will be considered established once this protocol is open.
Note: This field isn’t present for the default set, as this is handled internally by the networking code.
fallback_names: Vec<ProtocolName>
If the remote reports that it doesn’t support the protocol indicated in the
notifications_protocol
field, then each of these fallback names will be tried one by
one.
If a fallback is used, it will be reported in
sc_network::protocol::event::Event::NotificationStreamOpened::negotiated_fallback
handshake: Option<NotificationHandshake>
Handshake of the protocol
NOTE: Currently custom handshakes are not fully supported. See issue #5685 for more
details. This field is temporarily used to allow moving the hardcoded block announcement
protocol out of protocol.rs
.
max_notification_size: u64
Maximum allowed size of single notifications.
set_config: SetConfig
Base configuration.
Implementations§
source§impl NonDefaultSetConfig
impl NonDefaultSetConfig
sourcepub fn new(
notifications_protocol: ProtocolName,
max_notification_size: u64
) -> Self
pub fn new( notifications_protocol: ProtocolName, max_notification_size: u64 ) -> Self
Creates a new NonDefaultSetConfig
. Zero slots and accepts only reserved nodes.
sourcepub fn allow_non_reserved(&mut self, in_peers: u32, out_peers: u32)
pub fn allow_non_reserved(&mut self, in_peers: u32, out_peers: u32)
Modifies the configuration to allow non-reserved nodes.
sourcepub fn add_reserved(&mut self, peer: MultiaddrWithPeerId)
pub fn add_reserved(&mut self, peer: MultiaddrWithPeerId)
Add a node to the list of reserved nodes.
sourcepub fn add_fallback_names(&mut self, fallback_names: Vec<ProtocolName>)
pub fn add_fallback_names(&mut self, fallback_names: Vec<ProtocolName>)
Add a list of protocol names used for backward compatibility.
See the explanations in NonDefaultSetConfig::fallback_names
.
Trait Implementations§
source§impl Clone for NonDefaultSetConfig
impl Clone for NonDefaultSetConfig
source§fn clone(&self) -> NonDefaultSetConfig
fn clone(&self) -> NonDefaultSetConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for NonDefaultSetConfig
impl Send for NonDefaultSetConfig
impl Sync for NonDefaultSetConfig
impl Unpin for NonDefaultSetConfig
impl UnwindSafe for NonDefaultSetConfig
Blanket Implementations§
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, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§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 Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.