Skip to content

Commit 3317ea1

Browse files
authored
docs: cleanup discv4 docs (paradigmxyz#13884)
1 parent c4b147c commit 3317ea1

File tree

3 files changed

+16
-317
lines changed

3 files changed

+16
-317
lines changed

crates/net/discv4/src/lib.rs

+16-7
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,10 @@ pub(crate) type IngressReceiver = mpsc::Receiver<IngressEvent>;
157157

158158
type NodeRecordSender = OneshotSender<Vec<NodeRecord>>;
159159

160-
/// The Discv4 frontend
160+
/// The Discv4 frontend.
161161
///
162-
/// This communicates with the [`Discv4Service`] by sending commands over a channel.
162+
/// This is a cloneable type that communicates with the [`Discv4Service`] by sending commands over a
163+
/// shared channel.
163164
///
164165
/// See also [`Discv4::spawn`]
165166
#[derive(Debug, Clone)]
@@ -174,11 +175,10 @@ pub struct Discv4 {
174175
node_record: Arc<Mutex<NodeRecord>>,
175176
}
176177

177-
// === impl Discv4 ===
178-
179178
impl Discv4 {
180-
/// Same as [`Self::bind`] but also spawns the service onto a new task,
181-
/// [`Discv4Service::spawn()`]
179+
/// Same as [`Self::bind`] but also spawns the service onto a new task.
180+
///
181+
/// See also: [`Discv4Service::spawn()`]
182182
pub async fn spawn(
183183
local_address: SocketAddr,
184184
local_enr: NodeRecord,
@@ -421,6 +421,15 @@ impl Discv4 {
421421
///
422422
/// This is a [Stream] to handles incoming and outgoing discv4 messages and emits updates via:
423423
/// [`Discv4Service::update_stream`].
424+
///
425+
/// This type maintains the discv Kademlia routing table and is responsible for performing lookups.
426+
///
427+
/// ## Lookups
428+
///
429+
/// See also [Recursive Lookups](https://github.com/ethereum/devp2p/blob/master/discv4.md#recursive-lookup).
430+
/// Lookups are either triggered periodically or performaned on demand: [`Discv4::lookup`]
431+
/// Newly discovered nodes are emitted as [`DiscoveryUpdate::Added`] event to all subscribers:
432+
/// [`Discv4Service::update_stream`].
424433
#[must_use = "Stream does nothing unless polled"]
425434
pub struct Discv4Service {
426435
/// Local address of the UDP socket.
@@ -694,7 +703,7 @@ impl Discv4Service {
694703

695704
/// Spawns this services onto a new task
696705
///
697-
/// Note: requires a running runtime
706+
/// Note: requires a running tokio runtime
698707
pub fn spawn(mut self) -> JoinHandle<()> {
699708
tokio::task::spawn(async move {
700709
self.bootstrap();

docs/crates/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
A tour of the various crates that make up reth.
44

55
- [`reth-db`](./db.md)
6-
- [`reth-discv4`](./discv4.md)
76
- [`reth-eth-wire`](./eth-wire.md)
87
- [`reth-network`](./network.md)
98
- [`reth-stages`](./stages.md)

docs/crates/discv4.md

-309
This file was deleted.

0 commit comments

Comments
 (0)