Skip to content

Commit

Permalink
docs: cleanup discv4 docs (#13884)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 21, 2025
1 parent c4b147c commit 3317ea1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 317 deletions.
23 changes: 16 additions & 7 deletions crates/net/discv4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ pub(crate) type IngressReceiver = mpsc::Receiver<IngressEvent>;

type NodeRecordSender = OneshotSender<Vec<NodeRecord>>;

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

// === impl Discv4 ===

impl Discv4 {
/// Same as [`Self::bind`] but also spawns the service onto a new task,
/// [`Discv4Service::spawn()`]
/// Same as [`Self::bind`] but also spawns the service onto a new task.
///
/// See also: [`Discv4Service::spawn()`]
pub async fn spawn(
local_address: SocketAddr,
local_enr: NodeRecord,
Expand Down Expand Up @@ -421,6 +421,15 @@ impl Discv4 {
///
/// This is a [Stream] to handles incoming and outgoing discv4 messages and emits updates via:
/// [`Discv4Service::update_stream`].
///
/// This type maintains the discv Kademlia routing table and is responsible for performing lookups.
///
/// ## Lookups
///
/// See also [Recursive Lookups](https://github.com/ethereum/devp2p/blob/master/discv4.md#recursive-lookup).
/// Lookups are either triggered periodically or performaned on demand: [`Discv4::lookup`]
/// Newly discovered nodes are emitted as [`DiscoveryUpdate::Added`] event to all subscribers:
/// [`Discv4Service::update_stream`].
#[must_use = "Stream does nothing unless polled"]
pub struct Discv4Service {
/// Local address of the UDP socket.
Expand Down Expand Up @@ -694,7 +703,7 @@ impl Discv4Service {

/// Spawns this services onto a new task
///
/// Note: requires a running runtime
/// Note: requires a running tokio runtime
pub fn spawn(mut self) -> JoinHandle<()> {
tokio::task::spawn(async move {
self.bootstrap();
Expand Down
1 change: 0 additions & 1 deletion docs/crates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
A tour of the various crates that make up reth.

- [`reth-db`](./db.md)
- [`reth-discv4`](./discv4.md)
- [`reth-eth-wire`](./eth-wire.md)
- [`reth-network`](./network.md)
- [`reth-stages`](./stages.md)
309 changes: 0 additions & 309 deletions docs/crates/discv4.md

This file was deleted.

0 comments on commit 3317ea1

Please sign in to comment.