Skip to main content

StatelessRequest

Struct StatelessRequest 

Source
pub struct StatelessRequest<R, W> { /* private fields */ }
Expand description

The stateless request/response substrate per POST (ADR-005 §2): wraps (request-reader, response-writer, Limits, Service) into the machinery that performs the capability-dump skip, the delim-aware arg split, and the flush-only probe rule on the read side, and hands the response rules to the machine on the write side.

The transport-level error taxonomy is SubstrateError with the duplex machinery’s semantics: terminal errors are cached and re-reported without re-entering the transport (the unconditional error-break rule, observable via StatelessRequest::transport_reads).

Implementations§

Source§

impl<R, W> StatelessRequest<R, W>

Source

pub fn new(reader: R, writer: W, limits: Limits, service: Service) -> Self

Wraps one POST’s (request-reader, response-writer, limits, service) per ADR-005 §2. The service rides the inputs per ADR-016 (the door’s route supplies it — nothing in the POST body distinguishes the services); dispatch on it is wave 2.

Source

pub fn service(&self) -> Service

The service this POST was accepted for (ADR-016 §3).

Source

pub fn limits(&self) -> &Limits

The session’s budget bundle (ADR-009; the request-body budget is enforced by StatelessRequest::read_post, the rest is the later waves’ machines’ to reach).

Source

pub fn consumed_bytes(&self) -> u64

Request-body bytes consumed by the read side so far.

Source

pub fn transport_reads(&self) -> u64

Transport read calls issued so far — the observable behind the unconditional error-break rule: after a terminal read error this counter must stop advancing.

Source

pub fn response(&mut self) -> &mut StatelessResponse<W>

The response end (ADR-005 §2’s response rules: one-shot flush, no 0002, data-after-flush refused).

Source

pub fn take_raw_tail(&mut self) -> Result<RawTail<R>, SubstrateError>

The raw-tail escape (ADR-013 §3; ADR-018 §4): after StatelessRequest::read_post resolved a command invocation, the pkt-line machinery surrenders the POST body’s remaining bytes as a raw async reader (RawTail) — the pack follows the command flush unframed inside the same body. The no-byte-loss argument mirrors the duplex escape: the demand-driven iterator reads with exact framing and clears its buffer at the stop, so at surrender the body reader is positioned byte-exactly after the terminating flush; the body-budget consumed counter rides the tail for observability (the POST’s total reconciles).

Machinery misuse is refused, never silently re-entered:

Contract stamp: ADR-013 §3, ADR-020 §1, ADR-018 §4, ADR-005 §2, ADR-009 (the body-budget observability).

Source

pub async fn read_post(&mut self) -> Result<StatelessPost, SubstrateError>

Reads the POST body as one command invocation (ADR-005 §2). The request shape is the service’s (Service::UploadPack — the V2 command invocation; Service::ReceivePack — the V0-framed push request, ADR-013 §3), and the parse rules — terminal failures, the probe shape, the per-POST refusal — are service-shared.

Auto Trait Implementations§

§

impl<R, W> !RefUnwindSafe for StatelessRequest<R, W>

§

impl<R, W> !UnwindSafe for StatelessRequest<R, W>

§

impl<R, W> Freeze for StatelessRequest<R, W>

§

impl<R, W> Send for StatelessRequest<R, W>
where Option<StreamingPeekableIter<CountingRead<R>>>: Send, StatelessResponse<W>: Send,

§

impl<R, W> Sync for StatelessRequest<R, W>
where Option<StreamingPeekableIter<CountingRead<R>>>: Sync, StatelessResponse<W>: Sync,

§

impl<R, W> Unpin for StatelessRequest<R, W>

§

impl<R, W> UnsafeUnpin for StatelessRequest<R, W>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more