Skip to main content

Module coverage

Module coverage 

Source
Expand description

Range-keyed block coverage bitmap (ADR 039-adjacent partial-holder discovery).

A blob is divided into fixed-size DISCOVERY_BLOCK_BYTES “discovery blocks” (64 MiB each); Coverage is a bitmap over those block indices recording which blocks a holder can serve. This is the wire-level granularity partial-holder discovery advertises and queries at — coarse enough that a 64 MiB blob (this codebase’s common case, #1164) still fits in one bit, fine enough that a multi-GB blob’s holders can be told apart by which slice they actually hold.

Coverage itself only carries the bitmap; deriving one from a node’s actual cache state (or from origin capability) is the caller’s job — see decdn_cache::CacheEngine::coverage for the cached-block derivation.

Structs§

Coverage
A bitmap over discovery-block indices: bit i records whether block i (bytes [i * DISCOVERY_BLOCK_BYTES, (i + 1) * DISCOVERY_BLOCK_BYTES)) is covered.

Constants§

DISCOVERY_BLOCK_BYTES
Size of one discovery block: 64 MiB.
MAX_COVERAGE_BYTES
Upper bound, in bytes, on a Coverage bitmap decoded from untrusted wire.
MAX_DISCOVERABLE_BLOB_BYTES
Largest blob the discovery layer describes on the wire: 100 GiB.

Functions§

discovery_block_bytes
The active discovery-block size in bytes.
num_blocks
Number of discovery_block_bytes blocks a blob of total_bytes spans.