File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
crates/apollo_network/src/network_manager Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff 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.
6186pub struct GenericNetworkManager < SwarmT : SwarmTrait > {
6287 swarm : SwarmT ,
6388 inbound_protocol_to_buffer_size : HashMap < StreamProtocol , usize > ,
You can’t perform that action at this time.
0 commit comments