[][src]Struct libp2p_gossipsub::GossipsubConfig

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 hash_topics: bool,
    pub no_source_id: bool,
    pub manual_propagation: bool,
    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 4).

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).

hash_topics: bool

Flag determining if gossipsub topics are hashed or sent as plain strings (default is false).

no_source_id: bool

When set, all published messages will have a 0 source PeerId (default is false).

manual_propagation: 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 propagate_message() on the behaviour to forward message once validated (default is false).

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

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> Clear for T where
    T: InitializableFromZeroed + ?Sized

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

impl<T> InitializableFromZeroed for T where
    T: Default

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

impl<T> Same<T> for T

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>,