Struct libp2p_gossipsub::GossipsubConfig [−][src]
Configuration parameters that define the performance of the gossipsub network.
Fields
protocol_id: Cow<'static, [u8]>
The protocol id to negotiate this protocol (default is /meshsub/1.0.0
).
history_length: usize
Number of heartbeats to keep in the memcache
(default is 5).
history_gossip: usize
Number of past heartbeats to gossip about (default is 3).
mesh_n: usize
Target number of peers for the mesh network (D in the spec, default is 6).
mesh_n_low: usize
Minimum number of peers in mesh network before adding more (D_lo in the spec, default is 5).
mesh_n_high: usize
Maximum number of peers in mesh network before removing some (D_high in the spec, default is 12).
gossip_lazy: usize
Number of peers to emit gossip to during a heartbeat (D_lazy in the spec, default is 6).
heartbeat_initial_delay: Duration
Initial delay in each heartbeat (default is 5 seconds).
heartbeat_interval: Duration
Time between each heartbeat (default is 1 second).
fanout_ttl: Duration
Time to live for fanout peers (default is 60 seconds).
max_transmit_size: usize
The maximum byte size for each gossip (default is 2048 bytes).
duplicate_cache_time: Duration
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.
hash_topics: bool
Flag determining if gossipsub topics are hashed or sent as plain strings (default is false).
validate_messages: bool
When set to true
, prevents automatic forwarding of all received messages. This setting
allows a user to validate the messages before propagating them to their peers. If set to
true, the user must manually call validate_message()
on the behaviour to forward message
once validated (default is false
). Furthermore, the application may optionally call
invalidate_message()
on the behaviour to remove the message from the memcache. The
default is false.
validation_mode: ValidationMode
Determines the level of validation used when receiving messages. See ValidationMode
for the available types. The default is ValidationMode::Strict.
message_id_fn: fn(_: &GossipsubMessage) -> MessageId
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.
Trait Implementations
impl Clone for GossipsubConfig
[src]
fn clone(&self) -> GossipsubConfig
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for GossipsubConfig
[src]
impl Default for GossipsubConfig
[src]
fn default() -> GossipsubConfig
[src]
Auto Trait Implementations
impl RefUnwindSafe for GossipsubConfig
impl Send for GossipsubConfig
impl Sync for GossipsubConfig
impl Unpin for GossipsubConfig
impl UnwindSafe for GossipsubConfig
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,