Struct libp2p_gossipsub::GossipsubConfig[][src]

pub struct GossipsubConfig {
    pub protocol_id: Cow<'static, [u8]>,
    pub history_length: usize,
    pub history_gossip: usize,
    pub mesh_n: usize,
    pub mesh_n_low: usize,
    pub mesh_n_high: usize,
    pub gossip_lazy: usize,
    pub heartbeat_initial_delay: Duration,
    pub heartbeat_interval: Duration,
    pub fanout_ttl: Duration,
    pub max_transmit_size: usize,
    pub duplicate_cache_time: Duration,
    pub hash_topics: bool,
    pub validate_messages: bool,
    pub validation_mode: ValidationMode,
    pub message_id_fn: fn(_: &GossipsubMessage) -> MessageId,
}

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]

impl Debug for GossipsubConfig[src]

impl Default for 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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]