Skip to content

Commit

Permalink
Add better documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ramfox committed Jun 4, 2024
1 parent 3f06380 commit 132dfd0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions iroh-gossip/src/proto/topic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ use super::{
};
use super::{PeerData, PeerIdentity};

// The default maximum size in bytes for a gossip message.
// This is a sane but arbitrary default and can be changed in the [`Config`].
const DEFAULT_MAX_MESSAGE_SIZE: usize = 4096;

/// Input event to the topic state handler.
#[derive(Clone, Debug)]
pub enum InEvent<PI> {
Expand Down Expand Up @@ -170,16 +174,21 @@ impl<PI: Clone> IO<PI> for VecDeque<OutEvent<PI>> {
self.push_back(event.into())
}
}

/// Protocol configuration
#[derive(Clone, Debug)]
pub struct Config {
/// Configuration for the swarm membership layer
pub membership: hyparview::Config,
/// Configuration for the gossip broadcast layer
pub broadcast: plumtree::Config,
/// Max message size in bytes
/// Max message size in bytes.
///
/// This size should be the same across a network to ensure all nodes can transmit and read large messages.
///
/// At minimum, this size should be large enough to send gossip control messages. This can vary, depending on the size of the [`PeerIdentifier`] you use and the size of the [`PeerData`] you transmit in your messages.
///
/// Default is 4096 bytes.
/// The default is [`DEFAULT_MAX_MESSAGE_SIZE`].
pub max_message_size: usize,
}

Expand Down

0 comments on commit 132dfd0

Please sign in to comment.