Skip to main content

StreamRequest

Struct StreamRequest 

Source
pub struct StreamRequest {
    pub hash: [u8; 32],
    pub namespace_id: [u8; 32],
    pub pool_id: [u8; 32],
    pub byte_offset: u64,
    pub byte_len: u64,
    pub timestamp_us: u64,
}
Expand description

Payer → node request opening a paid delivery (ADR 005 §cdn/client/v1).

timestamp_us is a requester-generated microsecond timestamp echoed back in StreamResponseBody::timestamp_us; it both correlates the response and drives rate-manipulation slashing (ADR 005, ADR 014). byte_offset supports seek/resume on failover — the requester reconnects to another node and resumes from the last BLAKE3-verified byte.

This struct holds only the frozen base fields (ADR 013 §Tier 1). The optional StreamRequestExt is carried as separate trailing bytes after this message in the frame, parsed via parse_stream_request_ext — not as an embedded field. This is the ADR 005 §Client identity binding two-phase deserialization pattern: keeping the base frozen and parsing extension bytes separately means a future field added to StreamRequestExt stays backward-compatible (old senders simply emit fewer trailing bytes; new optional fields are appended and old receivers skip them). Embedding ext as a nested struct field instead would break old Some(...) senders the moment a field is added (postcard would hit EOF inside the nested struct). Use encode_stream_request to build the wire payload with an optional ext.

Fields§

§hash: [u8; 32]

BLAKE3 hash of the requested blob (iroh Hash, 32 bytes).

§namespace_id: [u8; 32]

Namespace the content is published under, as a big-endian uint256 (ADR 002 §Retrieval by namespace, ADR 005 §Namespace routing). All-zero = no namespace: the node serves best-effort from local cache / DHT only, with no authorized origins. A non-zero value routes cache-miss origin pulls to that namespace’s OriginAssignment set. It is a routing hint, not a trust anchor — returned bytes are verified against hash independently, so a wrong/hostile value can only fail the fetch, never corrupt delivery. The node layer converts this to an alloy U256; keeping it [u8; 32] here (like hash/pool_id) leaves protocol alloy-free. Billing-agnostic but load-bearing for routing, so it lives in the frozen base — every node reads it for origin routing (a node with no chain origin directory configured resolves nothing from it).

§pool_id: [u8; 32]

poolId = keccak256(owner, poolNonce) (ADR 005).

§byte_offset: u64

Resume position in bytes; 0 for a full-blob fetch.

§byte_len: u64

Upper bound on the requested range: the request covers the half-open span [byte_offset, byte_offset + byte_len). 0 means “to end-of-blob” (the whole-tail default, so an unset value preserves the prior behavior). A non-zero byte_len lets a node scope a cache-miss origin fetch to exactly the requested bytes and meters payment over the range (ADR 005 §Bounded byte ranges, ADR 037 §Origin-tier pull-through). Billing-relevant, so it lives in the frozen base — every node must understand it.

§timestamp_us: u64

Requester-generated microseconds since the Unix epoch, echoed back.

Trait Implementations§

Source§

impl Clone for StreamRequest

Source§

fn clone(&self) -> Self

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 StreamRequest

Source§

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

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

impl<'de> Deserialize<'de> for StreamRequest

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 Eq for StreamRequest

Source§

impl PartialEq for StreamRequest

Source§

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

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 StreamRequest

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.