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: u64The window start offset (echoed).
length: u64This window’s byte length.
bytes: StringThis window’s ciphertext, base64.
complete: boolWhether 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
impl Clone for RangeFrame
Source§fn clone(&self) -> RangeFrame
fn clone(&self) -> RangeFrame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more