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
impl UpstreamBody
Sourcepub fn from_incoming(
inner: Incoming,
idle: Option<Duration>,
health: Option<(Arc<UpstreamLb>, HealthDispatch)>,
) -> Self
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.
Sourcepub fn from_buffered(body: Bytes) -> Self
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).
Sourcepub fn from_h3_streaming(
rx: Receiver<Result<Bytes, UpstreamBodyError>>,
idle: Option<Duration>,
health: Option<(Arc<UpstreamLb>, HealthDispatch)>,
) -> Self
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.
Sourcepub fn set_release_permit(&mut self, permit: OwnedSemaphorePermit)
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.
Sourcepub fn set_deadline(&mut self, deadline: Instant)
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).
Sourcepub fn set_inflight_guard(&mut self, guard: InflightGuard)
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.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
REL-05 (#216): create an empty body (used as a placeholder while the first-frame buffer drains the real body).
Sourcepub fn set_inner(&mut self, inner: BoxBody<Bytes, UpstreamBodyError>)
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.
Sourcepub fn set_full(&mut self, body: Bytes)
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).
Sourcepub fn with_prefix(prefix: Bytes, rest: UpstreamBody) -> Self
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
impl Body for UpstreamBody
Source§type Error = UpstreamBodyError
type Error = UpstreamBodyError
Body might generate.Source§fn poll_frame(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<Bytes>, UpstreamBodyError>>>
fn poll_frame( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Frame<Bytes>, UpstreamBodyError>>>
Source§fn size_hint(&self) -> SizeHint
fn size_hint(&self) -> SizeHint
Source§fn is_end_stream(&self) -> bool
fn is_end_stream(&self) -> bool
true when the end of stream has been reached. Read moreAuto Trait Implementations§
impl Freeze for UpstreamBody
impl !RefUnwindSafe for UpstreamBody
impl Send for UpstreamBody
impl Sync for UpstreamBody
impl Unpin for UpstreamBody
impl !UnwindSafe for UpstreamBody
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specialization§impl<T> BodyExt for Twhere
T: Body + ?Sized,
impl<T> BodyExt for Twhere
T: Body + ?Sized,
§fn frame(&mut self) -> Frame<'_, Self>where
Self: Unpin,
fn frame(&mut self) -> Frame<'_, Self>where
Self: Unpin,
Frame, if any.§fn inspect_frame<F>(self, f: F) -> InspectFrame<Self, F>
fn inspect_frame<F>(self, f: F) -> InspectFrame<Self, F>
§fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
§fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
§fn collect(self) -> Collect<Self>where
Self: Sized,
fn collect(self) -> Collect<Self>where
Self: Sized,
Collected] body which will collect all the DATA frames
and trailers.§fn with_trailers<F>(self, trailers: F) -> WithTrailers<Self, F>
fn with_trailers<F>(self, trailers: F) -> WithTrailers<Self, F>
§fn into_stream(self) -> BodyStream<Self>where
Self: Sized,
fn into_stream(self) -> BodyStream<Self>where
Self: Sized,
BodyStream].§fn into_data_stream(self) -> BodyDataStream<Self>where
Self: Sized,
fn into_data_stream(self) -> BodyDataStream<Self>where
Self: Sized,
BodyDataStream].Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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