Skip to main content

FetchRangeParams

Struct FetchRangeParams 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§store_id: HexId

The store launcher id (64-hex, required).

§root: HexId

The generation root (64-hex, required for a resource fetch).

§retrieval_key: HexId

SHA-256(urn) (64-hex, required for a resource fetch).

§offset: Option<u64>

The range start (default 0).

§length: u64

The 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

Source

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.

Source

pub fn with_offset(self, offset: u64) -> Self

Start the range at offset rather than at 0.

Source

pub fn with_capsule(self, capsule: bool) -> Self

Request whole-capsule mode. Capsule range fetch is not yet served — a true here yields ResourceUnavailable.

Source

pub fn with_redirect_depth(self, redirect_depth: u64) -> Self

Echo the redirect budget already consumed, from a -32008 redirect.

Source

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.

Source

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

Source§

fn clone(&self) -> FetchRangeParams

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 FetchRangeParams

Source§

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

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

impl<'de> Deserialize<'de> for FetchRangeParams

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 FetchRangeParams

Source§

fn eq(&self, other: &FetchRangeParams) -> 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 FetchRangeParams

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 FetchRangeParams

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.