Struct libp2p_gossipsub::GossipsubConfigBuilder [−][src]
The builder struct for constructing a gossipsub configuration.
Implementations
impl GossipsubConfigBuilder
[src]
pub fn new() -> GossipsubConfigBuilder
[src]
pub fn protocol_id(
&mut self,
protocol_id: impl Into<Cow<'static, [u8]>>
) -> &mut Self
[src]
&mut self,
protocol_id: impl Into<Cow<'static, [u8]>>
) -> &mut Self
The protocol id to negotiate this protocol (default is /meshsub/1.0.0
).
pub fn history_length(&mut self, history_length: usize) -> &mut Self
[src]
Number of heartbeats to keep in the memcache
(default is 5).
pub fn history_gossip(&mut self, history_gossip: usize) -> &mut Self
[src]
Number of past heartbeats to gossip about (default is 3).
pub fn mesh_n(&mut self, mesh_n: usize) -> &mut Self
[src]
Target number of peers for the mesh network (D in the spec, default is 6).
pub fn mesh_n_low(&mut self, mesh_n_low: usize) -> &mut Self
[src]
Minimum number of peers in mesh network before adding more (D_lo in the spec, default is 4).
pub fn mesh_n_high(&mut self, mesh_n_high: usize) -> &mut Self
[src]
Maximum number of peers in mesh network before removing some (D_high in the spec, default is 12).
pub fn gossip_lazy(&mut self, gossip_lazy: usize) -> &mut Self
[src]
Number of peers to emit gossip to during a heartbeat (D_lazy in the spec, default is 6).
pub fn heartbeat_initial_delay(
&mut self,
heartbeat_initial_delay: Duration
) -> &mut Self
[src]
&mut self,
heartbeat_initial_delay: Duration
) -> &mut Self
Initial delay in each heartbeat (default is 5 seconds).
pub fn heartbeat_interval(&mut self, heartbeat_interval: Duration) -> &mut Self
[src]
Time between each heartbeat (default is 1 second).
pub fn fanout_ttl(&mut self, fanout_ttl: Duration) -> &mut Self
[src]
Time to live for fanout peers (default is 60 seconds).
pub fn max_transmit_size(&mut self, max_transmit_size: usize) -> &mut Self
[src]
The maximum byte size for each gossip (default is 2048 bytes).
pub fn duplicate_cache_time(&mut self, cache_size: Duration) -> &mut Self
[src]
Duplicates are prevented by storing message id’s of known messages in an LRU time cache. This settings sets the time period that messages are stored in the cache. Duplicates can be received if duplicate messages are sent at a time greater than this setting apart. The default is 1 minute.
pub fn hash_topics(&mut self) -> &mut Self
[src]
When set, gossipsub topics are hashed instead of being sent as plain strings.
pub fn validate_messages(&mut self) -> &mut Self
[src]
When set, prevents automatic forwarding of all received messages. This setting
allows a user to validate the messages before propagating them to their peers. If set,
the user must manually call validate_message()
on the behaviour to forward a message
once validated.
pub fn validation_mode(&mut self, validation_mode: ValidationMode) -> &mut Self
[src]
Determines the level of validation used when receiving messages. See ValidationMode
for the available types. The default is ValidationMode::Strict.
pub fn message_id_fn(
&mut self,
id_fn: fn(_: &GossipsubMessage) -> MessageId
) -> &mut Self
[src]
&mut self,
id_fn: fn(_: &GossipsubMessage) -> MessageId
) -> &mut Self
A user-defined function allowing the user to specify the message id of a gossipsub message.
The default value is to concatenate the source peer id with a sequence number. Setting this
parameter allows the user to address packets arbitrarily. One example is content based
addressing, where this function may be set to hash(message)
. This would prevent messages
of the same content from being duplicated.
The function takes a GossipsubMessage
as input and outputs a String to be interpreted as
the message id.
pub fn build(&self) -> GossipsubConfig
[src]
Constructs a GossipsubConfig
from the given configuration.
Trait Implementations
impl Default for GossipsubConfigBuilder
[src]
fn default() -> GossipsubConfigBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for GossipsubConfigBuilder
impl Send for GossipsubConfigBuilder
impl Sync for GossipsubConfigBuilder
impl Unpin for GossipsubConfigBuilder
impl UnwindSafe for GossipsubConfigBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,