Skip to content

Commit 882de66

Browse files
apollo_network: added network manager GenericNetworkManager docs (#8966)
* apollo_network: added misconduct score AddAssign docs * apollo_network: added network manager NetworkError docs * apollo_network: added network manager GenericNetworkManager docs
1 parent e018073 commit 882de66

File tree

1 file changed

+25
-0
lines changed
  • crates/apollo_network/src/network_manager

1 file changed

+25
-0
lines changed

crates/apollo_network/src/network_manager/mod.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,31 @@ pub enum NetworkError {
5858
#[error("Channels for broadcast topic with hash {topic_hash:?} were dropped.")]
5959
BroadcastChannelsDropped { topic_hash: TopicHash },
6060
}
61+
62+
/// Generic network manager that handles all networking operations.
63+
///
64+
/// This is the core networking component that manages connections, protocols,
65+
/// and message routing. It's generic over the swarm type to allow for testing
66+
/// with mock swarms.
67+
///
68+
/// The network manager operates in an event-driven manner, continuously processing:
69+
/// - Swarm events (connections, disconnections, protocol events)
70+
/// - SQMR protocol sessions (queries and responses)
71+
/// - Broadcast message propagation
72+
/// - Peer reputation reports
73+
///
74+
/// # Type Parameters
75+
///
76+
/// * `SwarmT` - The underlying swarm implementation (typically `libp2p::Swarm`)
77+
///
78+
/// # Lifecycle
79+
///
80+
/// 1. **Initialization**: Create with [`NetworkManager::new`] or
81+
/// `GenericNetworkManager::generic_new`
82+
/// 2. **Protocol Registration**: Register SQMR protocols and broadcast topics
83+
/// 3. **Execution**: Run the event loop with [`GenericNetworkManager::run`]
84+
///
85+
/// The event loop will continue running until an unrecoverable error occurs.
6186
pub struct GenericNetworkManager<SwarmT: SwarmTrait> {
6287
swarm: SwarmT,
6388
inbound_protocol_to_buffer_size: HashMap<StreamProtocol, usize>,

0 commit comments

Comments
 (0)