Expand description
ProviderRecord — the value the DHT stores: “peer P holds content C, reachable at these
addresses, until this expiry” — plus the CandidateAddr address shape it carries.
A provider record is what announce_provider PUTs and find_providers returns. It binds a
content key (the ContentId hashed into the keyspace) to the
peer_id of a node that holds it, together with candidate addresses so the finder can then
open a dig-nat connection and fetch over the L7 peer RPC. Records are TTL’d (expires_at)
and republished by the holder before expiry, so stale providers age out of the DHT
automatically — a Kademlia provider record is soft state, not a permanent entry.
The CandidateAddr { host, port, kind } and the kind tokens are byte-compatible with the
L7 peer-network dig.getPeers addresses[] shape (§7), so a record’s addresses drop straight
into a PeerTarget for dig_nat::connect.
Structs§
- Candidate
Addr - One candidate address for a provider:
{ host, port, kind }(L7dig.getPeers§7). The finder dials these (most-direct-first) viadig_nat::connectto reach the provider. - Provider
Record - The DHT’s stored value: peer
provider_peer_idholds the content whose key iscontent_key, reachable ataddresses, untilexpires_at.
Enums§
- Address
Kind - How a candidate address was learned — the L7
dig.getPeersaddresses[].kindtokens (§7). The lowercase serde spelling is the frozen wire form; the ordering is most-direct-first (a dialer picks the lowest-rank dialable candidate).
Constants§
- MAX_
ADDRESSES_ PER_ RECORD - Maximum
CandidateAddrentries kept perProviderRecord/crate::routing::Contact.