Skip to content

Commit b6d1c0b

Browse files
apollo_network: added discovery ToOtherBehaviourEvent docs (starkware-libs#8937)
* apollo_network: added discovery RetryConfig docs * apollo_network: added discovery ToOtherBehaviourEvent docs
1 parent 3d2ed8f commit b6d1c0b

File tree

1 file changed

+21
-3
lines changed
  • crates/apollo_network/src/discovery

1 file changed

+21
-3
lines changed

crates/apollo_network/src/discovery/mod.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,30 @@ use tokio_retry::strategy::ExponentialBackoff;
4848
use crate::mixed_behaviour;
4949
use crate::mixed_behaviour::BridgedBehaviour;
5050

51-
/// Discovery event type.
52-
/// Discovery has no external events and outputs only events for other behaviours
51+
/// Events emitted by the discovery behavior to coordinate with other network behaviors.
52+
///
53+
/// The discovery behavior doesn't emit external events directly but instead
54+
/// coordinates with other behaviors (like Kademlia) to implement the full
55+
/// discovery process.
5356
#[derive(Debug)]
5457
pub enum ToOtherBehaviourEvent {
58+
/// Request a Kademlia query for the specified peer.
59+
///
60+
/// This event is used to trigger Kademlia DHT queries to find peers
61+
/// or gather routing table information.
5562
RequestKadQuery(PeerId),
56-
FoundListenAddresses { peer_id: PeerId, listen_addresses: Vec<Multiaddr> },
63+
64+
/// Discovered listen addresses for a peer.
65+
///
66+
/// This event is emitted when the discovery process finds new listening
67+
/// addresses for a known peer, typically through the identify protocol
68+
/// or DHT queries.
69+
FoundListenAddresses {
70+
/// The peer whose addresses were discovered.
71+
peer_id: PeerId,
72+
/// The discovered listening addresses.
73+
listen_addresses: Vec<Multiaddr>,
74+
},
5775
}
5876

5977
/// Discovery behaviour that handles the bootstrapping and Kademlia requesting

0 commit comments

Comments
 (0)