UpstreamBody

Struct UpstreamBody 

Source
pub struct UpstreamBody { /* private fields */ }
Expand description

The error is terminal for the stream: frames already forwarded to the client end abruptly (HTTP/1.1 truncation semantics); it is never retried (an attempt is final once its headers resolved).

Implementations§

Source§

impl UpstreamBody

Source

pub fn from_incoming( inner: Incoming, idle: Option<Duration>, health: Option<(Arc<UpstreamLb>, HealthDispatch)>, ) -> Self

Wrap a streaming TCP/TLS upstream body (Incoming) with the DW-014 idle/deadline/health knobs. idle is the response-body inactivity timeout (timeouts.write_ms); health carries the dispatch’s passive-health tracker for mid-body failure reporting. The legacy pooled-client path uses this constructor.

Source

pub fn from_buffered(body: Bytes) -> Self

Wrap a fully-buffered H3 response body (DW-108). The H3 transport collects the response into one Bytes (streaming H3 bodies are a follow-up; see dataplane::upstream_h3); the wrapper still applies the deadline knob (the body is already complete, so the idle timer never arms). health is None for H3 today (a buffered body cannot mid-stream abort, so there is no mid-body failure to report).

Source

pub fn from_h3_streaming( rx: Receiver<Result<Bytes, UpstreamBodyError>>, idle: Option<Duration>, health: Option<(Arc<UpstreamLb>, HealthDispatch)>, ) -> Self

Wrap a streaming H3 response body (PERF-10, #243): a channel-backed body that forwards h3 recv_data chunks as they arrive, matching the h1/h2 zero-buffer guarantee. The H3 transport spawns a driver task that reads recv_data from the h3 stream and sends each chunk through the channel; this constructor wraps the receiver as a BoxBody so the idle/deadline/health knobs apply uniformly across transports.

Source

pub fn set_release_permit(&mut self, permit: OwnedSemaphorePermit)

Attach the gateway concurrency-cap permit (DW-015): it releases when this body completes or is dropped, which is exactly the “release at body completion” contract of the global cap.

Source

pub fn set_deadline(&mut self, deadline: Instant)

Arm the ABSOLUTE body deadline (DW-039): set by the proxy from a gRPC request’s grpc-timeout (the deadline that bounded the forward, continuing through the body — the RPC’s total budget).

Source

pub fn set_inflight_guard(&mut self, guard: InflightGuard)

REL-06 (#217): attach the in-flight guard so the endpoint’s in-flight counter is held until the body stream completes (or the body is dropped). Used when body_completion_inflight is enabled in the upstream’s health config.

Source

pub fn empty() -> Self

REL-05 (#216): create an empty body (used as a placeholder while the first-frame buffer drains the real body).

Source

pub fn set_inner(&mut self, inner: BoxBody<Bytes, UpstreamBodyError>)

REL-05 (#216): replace the inner body with a pinned boxed body (the remaining stream after the first-frame buffer drained the prefix). The idle/deadline/health knobs are preserved.

Source

pub fn set_full(&mut self, body: Bytes)

REL-05 (#216): replace the inner body with a fully-buffered Bytes (the body completed within the first-frame buffer).

Source

pub fn with_prefix(prefix: Bytes, rest: UpstreamBody) -> Self

REL-05 (#216): create a body that emits a prefix then continues with rest. Used when the first-frame buffer filled: the prefix is flushed to the client, then the remaining upstream body streams frame-by-frame.

Trait Implementations§

Source§

impl Body for UpstreamBody

Source§

type Data = Bytes

Values yielded by the Body.
Source§

type Error = UpstreamBodyError

The error type this Body might generate.
Source§

fn poll_frame( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Frame<Bytes>, UpstreamBodyError>>>

Attempt to pull out the next frame of this stream. Read more
Source§

fn size_hint(&self) -> SizeHint

A hint that returns the bounds on the remaining length of the stream. Read more
Source§

fn is_end_stream(&self) -> bool

A hint that may return true when the end of stream has been reached. Read more
Source§

impl Debug for UpstreamBody

Source§

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

Formats the value using the given formatter. Read more

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
§

impl<T> AnyExt for T
where T: Any + ?Sized,

§

fn downcast_ref<T>(this: &Self) -> Option<&T>
where T: Any,

Attempts to downcast this to T behind reference
§

fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>
where T: Any,

Attempts to downcast this to T behind mutable reference
§

fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Any,

Attempts to downcast this to T behind Rc pointer
§

fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Any,

Attempts to downcast this to T behind Arc pointer
§

fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Any,

Attempts to downcast this to T behind Box pointer
§

fn downcast_move<T>(this: Self) -> Option<T>
where T: Any, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
§

impl<T> BodyExt for T
where T: Body + ?Sized,

§

fn frame(&mut self) -> Frame<'_, Self>
where Self: Unpin,

Returns a future that resolves to the next Frame, if any.
§

fn map_frame<F, B>(self, f: F) -> MapFrame<Self, F>
where Self: Sized, F: FnMut(Frame<Self::Data>) -> Frame<B>, B: Buf,

Maps this body’s frame to a different kind.
§

fn inspect_frame<F>(self, f: F) -> InspectFrame<Self, F>
where Self: Sized, F: FnMut(&Frame<Self::Data>),

A body that calls a function with a reference to each frame before yielding it.
§

fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: FnMut(Self::Error) -> E,

Maps this body’s error value to a different value.
§

fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
where Self: Sized, F: FnMut(&Self::Error),

A body that calls a function with a reference to an error before yielding it.
§

fn boxed(self) -> BoxBody<Self::Data, Self::Error>
where Self: Sized + Send + Sync + 'static,

Turn this body into a boxed trait object.
§

fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
where Self: Sized + Send + 'static,

Turn this body into a boxed trait object that is !Sync.
§

fn collect(self) -> Collect<Self>
where Self: Sized,

Turn this body into [Collected] body which will collect all the DATA frames and trailers.
§

fn with_trailers<F>(self, trailers: F) -> WithTrailers<Self, F>
where Self: Sized, F: Future<Output = Option<Result<HeaderMap, Self::Error>>>,

Add trailers to the body. Read more
§

fn into_stream(self) -> BodyStream<Self>
where Self: Sized,

Turn this body into [BodyStream].
§

fn into_data_stream(self) -> BodyDataStream<Self>
where Self: Sized,

Turn this body into [BodyDataStream].
§

fn fuse(self) -> Fuse<Self>
where Self: Sized,

Creates a “fused” body. 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
§

impl<T, X> CoerceTo<T> for X
where T: CoerceFrom<X> + ?Sized,

§

fn coerce_rc_to(self: Rc<X>) -> Rc<T>

§

fn coerce_box_to(self: Box<X>) -> Box<T>

§

fn coerce_ref_to(&self) -> &T

§

fn coerce_mut_to(&mut self) -> &mut T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

§

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

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,