Struct sc_network_common::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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.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>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
T
. Read more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.