pub struct AlignedRange { /* private fields */ }Expand description
The chunk-group-aligned byte span a node must fetch from origin to serve a
requested [byte_offset, byte_offset + byte_len), plus the chunk ranges to
import. A bao proof covers whole 16 KiB groups, so the fetch widens to the
enclosing group boundaries (the extra bytes are paid origin egress but never
re-served as client bytes — the request is still scoped, not whole-blob).
Fields are private and the only constructor is align_range, so holding an
AlignedRange guarantees its invariants: fetch_start <= fetch_end, both
group-aligned (or fetch_end == blob_size for the final partial group), and
chunk_ranges exactly covers [fetch_start, fetch_end).
Implementations§
Source§impl AlignedRange
impl AlignedRange
Sourcepub const fn blob_size(&self) -> u64
pub const fn blob_size(&self) -> u64
Whole-blob size this range was aligned against — the signed total_bytes
align_range was given. Held so wire_len and
encode_verified_range cannot be handed a blob_size that disagrees
with the chunk_ranges.
Sourcepub fn wire_len(&self) -> u64
pub fn wire_len(&self) -> u64
Exact header-less bao wire byte count for this range (content plus interleaved proof, ADR 038) — the paid quantity, and the receiver’s voucher-cadence / overrun / short-delivery bound.
This is bao_encoded_size applied to this range’s own blob_size and
chunk_ranges, so the two can never drift: a mismatched (total, ranges)
pair would otherwise silently yield a plausible-but-wrong payment bound
with no runtime backstop — the one misuse seam the crypto never sees.
Sourcepub const fn fetch_start(&self) -> u64
pub const fn fetch_start(&self) -> u64
First byte to fetch (the requested offset floored to a group boundary).
Sourcepub const fn fetch_end(&self) -> u64
pub const fn fetch_end(&self) -> u64
One past the last byte to fetch (requested end ceiled to a group boundary, then clamped to the blob size for the final partial group).
Sourcepub const fn chunk_ranges(&self) -> &ChunkRanges
pub const fn chunk_ranges(&self) -> &ChunkRanges
Chunk ranges (1 KiB ChunkNum units) the fetched bytes cover — passed to
both encode_verified_range and import_bao_bytes.