Skip to main content

StreamError

Enum StreamError 

Source
pub enum StreamError {
    NotFound,
    Declined,
    Unfunded,
    VoucherRejected {
        reason: VoucherRejectReason,
        bundle: Option<WatermarkBundle>,
    },
}
Expand description

A stream failure code (ADR 005 §Open-time refusal classes).

NotFound, Declined, and Unfunded are the open-time refusal classes and ride in StreamResponseExt::error alongside ok: false. VoucherRejected is the only variant delivered mid-stream, inside a ClientMessage::StreamError. All codes are unsigned and informational, never on-chain evidence. A node keeps its finer refusal reason in its own per-reason metrics. The wire carries only the class, because a requester acts on the class alone.

Every refusal scopes to the node that sent it, for the current fetch. A requester never ends a fetch on the word of one node.

Postcard encodes a struct variant’s payload positionally, in declaration order, so VoucherRejected’s bundle field sits after reason and any further field appends after bundle.

Variants§

§

NotFound

“No”: this node cannot serve the request now. The requester tries other nodes. This node can answer differently later.

§

Declined

“No, and stop asking”: this node will not serve this hash or request during this fetch. The requester removes it from the candidates for the hash for the rest of the fetch.

§

Unfunded

“No at the current funding”: this node will not serve this request at the requester’s current pool deposit or signer capability (ADR 003 §Funding recovery). The requester parks it at the current funding for this fetch, and asks it again only after a funding recovery step.

Spoken ONLY to a requester that passed the lane-ownership proof or holds a verified signer binding. Any other requester gets Self::NotFound for the same state, so pool and signer state stay unmappable off the wire.

§

VoucherRejected

Mid-stream payment-voucher rejection carried in a ClientMessage::StreamError message (never in the initial StreamResponse).

Fields

§reason: VoucherRejectReason

The specific validation failure.

§bundle: Option<WatermarkBundle>

The node’s true watermark plus the client’s own last-accepted signature, attached ONLY on the watermark-gated reasons (VoucherRejectReason::is_watermark_gated) and ONLY when the rejected voucher’s signature recovers to the capability’s pinned voucher_signer (issue #1481 §5 security property — otherwise anyone who guessed the chain-derivable pool_id could pull the node’s watermark). A wallet-less client cannot reconstruct its watermark from chain (the claim watermark is 0 until settlement), so this lets it self-heal: re-seed the ledger’s PAYMENT BASELINE to bytes_delivered (a pool-cumulative counter, NOT a blob byte_offset) and re-sign from the new baseline. None for every reason that is not watermark-gated and whenever the signer does not recover to voucher_signer.

Implementations§

Source§

impl StreamError

Source

pub const fn is_delivery_side(&self) -> bool

true for the delivery-side codes that ride in StreamResponseExt::error alongside ok: false — everything except VoucherRejected. Expresses the enum’s domain split in code rather than only in prose, and backs the StreamResponseExt::validate mid-stream-only exclusion.

Source

pub const fn is_mid_stream(&self) -> bool

true for the mid-stream-only StreamError::VoucherRejected, which rides exclusively in ClientMessage::StreamError.

Trait Implementations§

Source§

impl Clone for StreamError

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 StreamError

Source§

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

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

impl<'de> Deserialize<'de> for StreamError

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 StreamError

Source§

impl PartialEq for StreamError

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 StreamError

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 StreamError

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.