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: u64Resume position in bytes; 0 for a full-blob fetch.
byte_len: u64Upper 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: u64Requester-generated microseconds since the Unix epoch, echoed back.