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) -> &RangeSet<[ChunkNum; 2]>
pub const fn chunk_ranges(&self) -> &RangeSet<[ChunkNum; 2]>
Chunk ranges (1 KiB ChunkNum units) the fetched bytes cover — passed to
both encode_verified_range and import_bao_bytes.
Trait Implementations§
Source§impl Clone for AlignedRange
impl Clone for AlignedRange
Source§fn clone(&self) -> AlignedRange
fn clone(&self) -> AlignedRange
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AlignedRange
impl Debug for AlignedRange
impl Eq for AlignedRange
Source§impl PartialEq for AlignedRange
impl PartialEq for AlignedRange
impl StructuralPartialEq for AlignedRange
Auto Trait Implementations§
impl Freeze for AlignedRange
impl RefUnwindSafe for AlignedRange
impl Send for AlignedRange
impl Sync for AlignedRange
impl Unpin for AlignedRange
impl UnsafeUnpin for AlignedRange
impl UnwindSafe for AlignedRange
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more