Skip to main content

Topic

Trait Topic 

Source
pub trait Topic {
    type Item: Serialize + Deserialize + Send + Sync + Debug + 'static;

    const BUFFER_SIZE: usize;
    const NAME: &'static str;
    const VALIDATE: bool;
    const MAX_MESSAGES: u32;
    const TIME_WINDOW: Duration = DEFAULT_GOSSIPSUB_RATE_LIMIT_TIME_WINDOW;
    const MAX_MESSAGE_SIZE: usize = MIN_SUPPORTED_MSG_SIZE;
}

Required Associated Constants§

Source

const BUFFER_SIZE: usize

Source

const NAME: &'static str

Source

const VALIDATE: bool

Source

const MAX_MESSAGES: u32

The maximum number of messages on this topic a peer can send in a burst. Implementations treat the budget as a token bucket that refills one message every TIME_WINDOW / MAX_MESSAGES, so this is also the number of messages a peer can send per TIME_WINDOW on average. Messages beyond the budget are rate limited by the network implementation. Must be at least one.

Provided Associated Constants§

Source

const TIME_WINDOW: Duration = DEFAULT_GOSSIPSUB_RATE_LIMIT_TIME_WINDOW

The time it takes to refill the whole budget of MAX_MESSAGES. Must be at least a nanosecond per message, so it cannot be zero.

Source

const MAX_MESSAGE_SIZE: usize = MIN_SUPPORTED_MSG_SIZE

Maximum size in bytes of a serialized message on this topic. Larger messages are dropped before they are deserialized.

Required Associated Types§

Source

type Item: Serialize + Deserialize + Send + Sync + Debug + 'static

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§