Skip to main content

Module record

Module record 

Source
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§

CandidateAddr
One candidate address for a provider: { host, port, kind } (L7 dig.getPeers §7). The finder dials these (most-direct-first) via dig_nat::connect to reach the provider.
ProviderRecord
The DHT’s stored value: peer provider_peer_id holds the content whose key is content_key, reachable at addresses, until expires_at.

Enums§

AddressKind
How a candidate address was learned — the L7 dig.getPeers addresses[].kind tokens (§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 CandidateAddr entries kept per ProviderRecord / crate::routing::Contact.