Skip to main content

RangeFrame

Struct RangeFrame 

Source
pub struct RangeFrame {
    pub offset: u64,
    pub length: u64,
    pub bytes: String,
    pub complete: bool,
    pub total_length: Option<u64>,
    pub chunk_lens: Option<Vec<u64>>,
    pub chunk_index: Option<u64>,
    pub inclusion_proof: Option<String>,
    pub root: Option<HexId>,
    pub range_proof: Option<Vec<String>>,
    pub first_chunk_index: Option<u64>,
}
Expand description

One range frame of a resource: a byte window, plus the per-resource verification metadata that makes the window independently checkable.

EVERY frame may carry that metadata, and a server SHOULD attach it to every frame rather than only the first: a client fetching ranges in parallel from many holders cannot check a frame that declares no root, so a wrong-generation source would be detectable only after the whole resource had been paid for in bandwidth. The window is exactly the span the caller requested — never widened.

Fields§

§offset: u64

The window start offset (echoed).

§length: u64

This window’s byte length.

§bytes: String

This window’s ciphertext, base64.

§complete: bool

Whether this frame ends the resource.

§total_length: Option<u64>

The full resource ciphertext length. MAY appear on any frame.

§chunk_lens: Option<Vec<u64>>

Per-chunk ciphertext lengths of the full resource. MAY appear on any frame.

§chunk_index: Option<u64>

This frame’s first chunk index — the pre-existing alias of first_chunk_index, carrying the same value. OMITTED when the frame’s window does not begin on a chunk boundary.

§inclusion_proof: Option<String>

Whole-resource merkle proof, base64. MAY appear on any frame — and SHOULD, so a frame fetched from any holder is independently checkable on arrival.

§root: Option<HexId>

The chain-anchored root (64-hex) this frame’s resource verified against. MAY appear on any frame.

NOT A TRUST ANCHOR BY ITSELF. The client resolves the resource’s root from the URN (chain-anchored) and PINS it before fetching; a peer-declared value never replaces that pinned root. What this field provides is a generation-CONSISTENCY check: a frame declaring a root other than the pinned one is REJECTED and attributed to the offending peer (NC-9 fail-closed). So a declared root can only ever cause rejection — it can never move the pinned root, and never makes an unverified frame acceptable.

§range_proof: Option<Vec<String>>

RESERVED — not currently derivable; a server MUST NOT emit it.

Per-chunk merkle inclusion proofs for the chunks a frame covers. No such proof exists in the current store format: the generation root’s merkle leaves are per-RESOURCE (a leaf is the SHA-256 of a resource’s WHOLE ciphertext), so a single chunk has no leaf to prove. A client MUST NOT require this field, and per-range verification instead uses the whole-resource inclusion_proof together with the per-frame root/chunk_lens metadata.

Making it derivable requires a per-resource chunk-level commitment in the store format first (tracked as dig_ecosystem#1601). The field is kept in the wire type, unused, so populating it later is additive (§5.1); each entry would be an opaque base64 proof blob, since this pure level-00 wire type MUST NOT depend on the merkle primitive.

§first_chunk_index: Option<u64>

The chunk index of the first chunk in this frame (0-based, into the resource’s chunk sequence described by chunk_lens).

Present only when the frame’s window begins EXACTLY on a chunk boundary; a mid-chunk window omits it rather than assert an index the caller’s own alignment check would contradict. The served window is exactly the requested span — a server MUST NOT widen a range to a chunk boundary — so a frame is chunk-aligned only when the caller asked for an aligned span.

Trait Implementations§

Source§

impl Clone for RangeFrame

Source§

fn clone(&self) -> RangeFrame

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RangeFrame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RangeFrame

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for RangeFrame

Source§

fn eq(&self, other: &RangeFrame) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RangeFrame

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RangeFrame

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.