#[non_exhaustive]pub struct FetchRangeParams {
pub store_id: HexId,
pub root: HexId,
pub retrieval_key: HexId,
pub offset: Option<u64>,
pub length: u64,
pub capsule: Option<bool>,
pub redirect_depth: Option<u64>,
pub skip_layout: Option<bool>,
}Expand description
Params for dig.fetchRange — a single
range frame of a resource this node holds.
§Construction
Like RangeFrame, this type is #[non_exhaustive]: build it with
resource plus the with_* setters rather than a struct
literal, so a future additive field is a PATCH for every consumer instead of a
semver cascade.
§Cross-repo contract
skip_layout is byte-identical to
dig_nat::mux::RangeRequest::skip_layout, pinned in
tests/nat_wire_mirror.rs. The two enclosing types deliberately differ in every
other respect — dig-nat’s RangeRequest is a length-prefixed stream preamble,
this is a JSON-RPC params object with a redirect_depth dig-nat has no notion
of — so the byte-identical contract here is the FIELD, not the object.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.store_id: HexIdThe store launcher id (64-hex, required).
root: HexIdThe generation root (64-hex, required for a resource fetch).
retrieval_key: HexIdSHA-256(urn) (64-hex, required for a resource fetch).
offset: Option<u64>The range start (default 0).
length: u64The range length in bytes (> 0; clamped to the window cap).
capsule: Option<bool>Whole-capsule mode (default false). Capsule range fetch is not yet
served; a true here yields -32004.
redirect_depth: Option<u64>The redirect budget already consumed (echoed from a -32008 redirect).
skip_layout: Option<bool>Suppress the resource-scaling layout metadata (chunk_lens +
inclusion_proof) on this stream’s frames, because the client already holds
the commitment for this root.
A client that has already read the layout once — a resumed download, a second range of the same resource, a parallel fetch from another holder — does not need it again, and re-sending it costs a whole paged prologue PER STREAM: a 1,048,576-chunk layout is roughly 7.3 MB, which a 64-way parallel plan would otherwise pay 64 times over. Suppressing it is the difference between a bounded and an unbounded cost on the read path.
Absent or false preserves the pre-0.6.0 behaviour, so an older holder that
ignores this field is never broken by it — it simply sends metadata the client
discards. Read the rule through
suppresses_layout rather than re-deriving it.
The fixed-size identity fields (root,
total_length,
chunk_count,
chunk_index) are NOT suppressed: they are what
detects a wrong-generation holder on arrival, and a client that stopped
receiving them would lose that check on exactly the streams it fetches most.
Implementations§
Source§impl FetchRangeParams
impl FetchRangeParams
Sourcepub fn resource(
store_id: impl Into<HexId>,
root: impl Into<HexId>,
retrieval_key: impl Into<HexId>,
length: u64,
) -> Self
pub fn resource( store_id: impl Into<HexId>, root: impl Into<HexId>, retrieval_key: impl Into<HexId>, length: u64, ) -> Self
A range request for one content resource: length bytes of
retrieval_key’s ciphertext at the generation root.
Sourcepub fn with_offset(self, offset: u64) -> Self
pub fn with_offset(self, offset: u64) -> Self
Start the range at offset rather than at 0.
Sourcepub fn with_capsule(self, capsule: bool) -> Self
pub fn with_capsule(self, capsule: bool) -> Self
Request whole-capsule mode. Capsule range fetch is not yet served — a true
here yields
ResourceUnavailable.
Sourcepub fn with_redirect_depth(self, redirect_depth: u64) -> Self
pub fn with_redirect_depth(self, redirect_depth: u64) -> Self
Echo the redirect budget already consumed, from a -32008 redirect.
Sourcepub fn with_skip_layout(self, skip_layout: bool) -> Self
pub fn with_skip_layout(self, skip_layout: bool) -> Self
Ask the holder to omit the resource-scaling layout metadata, because this
client already holds the commitment for this root. See
skip_layout.
Sourcepub fn suppresses_layout(&self) -> bool
pub fn suppresses_layout(&self) -> bool
Whether this request suppresses the resource-scaling layout metadata.
The single home for the “absent or false means SEND the layout” rule. A
serve path that reached for skip_layout.is_some() instead would suppress the
layout for a client that had explicitly asked for it — unrecoverable for that
client, since the layout is a decrypt input it cannot obtain any other way on
that stream.
Trait Implementations§
Source§impl Clone for FetchRangeParams
impl Clone for FetchRangeParams
Source§fn clone(&self) -> FetchRangeParams
fn clone(&self) -> FetchRangeParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more