pub struct SubResponseBody { /* private fields */ }Expand description
Opaque handle to a streaming sub-request response body.
Pull-based: call next_chunk() to receive
the next body chunk. Returns Ok(None) at clean EOF.
Owns the live Pingora HTTP session, admission permit, connector (for session release), and all streaming deadlines. No background tasks or channels — downstream backpressure naturally paces upstream reads.
Implementations§
Source§impl SubResponseBody
impl SubResponseBody
Sourcepub fn received_bytes(&self) -> usize
pub fn received_bytes(&self) -> usize
Total bytes received so far.
Sourcepub fn chunk_count(&self) -> u64
pub fn chunk_count(&self) -> u64
Number of chunks received so far.
Sourcepub async fn next_chunk(&mut self) -> Result<Option<Bytes>, SubRequestError>
pub async fn next_chunk(&mut self) -> Result<Option<Bytes>, SubRequestError>
Pull the next body chunk from the upstream.
Returns:
Ok(Some(chunk))— a data chunk.Ok(None)— clean EOF; the session has been released to the pool.
§Errors
Err(StreamIdleTimeout)— upstream stalled foridle_timeout.Err(DeadlineExceeded)—max_stream_durationexpired.Err(ResponseTooLarge)— cumulative bytes exceededmax_total_bytes.Err(Io)— transport error or unclean EOF.
§Panics
Panics if the session is None when done is false (internal
invariant violation).
Trait Implementations§
Source§impl Drop for SubResponseBody
impl Drop for SubResponseBody
Auto Trait Implementations§
impl !Freeze for SubResponseBody
impl !RefUnwindSafe for SubResponseBody
impl !UnwindSafe for SubResponseBody
impl Send for SubResponseBody
impl Sync for SubResponseBody
impl Unpin for SubResponseBody
impl UnsafeUnpin for SubResponseBody
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more