Expand description
cdn/dht/v1 handler (ADR 022) — Kademlia content discovery.
Request handling:
FindNodehonored against the in-memory routing table.Storeadmission runs the full ADR 022 pipeline: holder == authenticatedNodeId, active-staker filter, per-publisher quota (200), global LRU (100k), per-hash provider cap (50), receiver- anchored TTL (1 h).FindValueconsults the record store + the routing table; per ADR 022 §Lookup integrity the requester-side filters (XOR-distance, active-staker, negative-probe-cache, randomisation) are the requester’s job and live in the iterative-lookup module (crate::dht::lookup).BatchStoreadmission (ADR 022 §Batch token accounting, #648): one batch-levelholder == authenticated NodeIdcheck (mismatch closes the stream withMALFORMED_MESSAGE), two-stage rate-limit accounting (stage 1 charged the inbound frame inserve; stage 2 charges up ton-1more, partially admitting the batch under budget), then per-hash insert sharing one receiver-anchoredreceive_us. The reply is aBatchStoreAckwith one bool per request hash, in request order. An oversize batch (>MAX_BATCH_STORE_HASHES) is rejected at wire decode withMALFORMED_MESSAGE.- Response variants arriving on a server-accepted stream are
rejected with
APP_ERR_UNSUPPORTED_MESSAGE.
Structs§
- DhtHandler
- Serves
cdn/dht/v1. Owns the routing table + the per-request rate limiter;accept()is reentrant — many concurrent streams from different peers all share the sameArc<DhtHandler>.