libp2p::kad

Constant K_VALUE

pub const K_VALUE: NonZero<usize>;
Available on crate feature kad only.
Expand description

The k parameter of the Kademlia specification.

This parameter determines:

  1. The (fixed) maximum number of nodes in a bucket.
  2. The (default) replication factor, which in turn determines: a) The number of closer peers returned in response to a request. b) The number of closest peers to a key to search for in an iterative query.

The choice of (1) is fixed to this constant. The replication factor is configurable but should generally be no greater than K_VALUE. All nodes in a Kademlia DHT should agree on the choices made for (1) and (2).

The current value is 20.