pub(crate) struct Drain {
remaining: usize,
waited: Duration,
log_waited: Duration,
}Expand description
Bounds forwarding the output after the process exited.
Fields§
§remaining: usize§waited: Duration§log_waited: DurationHow long the drain waited for the log drivers so far, see
Drain::recv_attach.
Implementations§
Source§impl Drain
impl Drain
Sourcepub(crate) async fn recv<F: Future>(&mut self, recv: F) -> Option<F::Output>
pub(crate) async fn recv<F: Future>(&mut self, recv: F) -> Option<F::Output>
Wait for the next message, giving up once the channel stays quiet for
DRAIN_TIMEOUT, DRAIN_MAX_MESSAGES were received or the waits
took DRAIN_MAX_WAIT.
Sourcefn take(&mut self) -> bool
fn take(&mut self) -> bool
Account for the next message, false once DRAIN_MAX_MESSAGES got
forwarded, which gets logged here.
Sourcepub(crate) fn exhausted(&self) -> bool
pub(crate) fn exhausted(&self) -> bool
Whether the drain forwarded or waited as much as it may.
Sourcepub(crate) async fn recv_output(
&mut self,
rx: &mut Receiver<Message>,
lag: Option<&mut Lag>,
) -> Option<Message>
pub(crate) async fn recv_output( &mut self, rx: &mut Receiver<Message>, lag: Option<&mut Lag>, ) -> Option<Message>
The next message of the attach output with Drain::recv. A
receiver which fell behind skips messages, which gets logged, for
the receiver of a client with its Lag, the one it kept before
the exit. None once the output ended or the drain gave up.
Sourcefn output(
res: Result<Message, RecvError>,
rx: &Receiver<Message>,
lag: Option<&mut Lag>,
) -> ControlFlow<Option<Message>>
fn output( res: Result<Message, RecvError>, rx: &Receiver<Message>, lag: Option<&mut Lag>, ) -> ControlFlow<Option<Message>>
What a result of the attach receiver rx means for the client, see
Drain::recv_output: the message, none once the output ended, or
skipped messages, which lag notes and the caller goes on after.
Sourcepub(crate) async fn recv_attach(
&mut self,
attach: &SharedContainerAttach,
rx: &mut Receiver<Message>,
lag: Option<&mut Lag>,
) -> Option<Message>
pub(crate) async fn recv_attach( &mut self, attach: &SharedContainerAttach, rx: &mut Receiver<Message>, lag: Option<&mut Lag>, ) -> Option<Message>
The next message of the attach output of attach like
Drain::recv_output, for a drain after the exit. A read loop which
holds output on its way into the log, see
SharedContainerAttach::logging, gets until DRAIN_MAX_LOG_WAIT
in total to broadcast it, which is no pause of the output: the client
must not lose the last output to a log write which takes longer than
DRAIN_TIMEOUT. The output which got broadcast already, or gets
broadcast meanwhile by another read loop, comes right away, a log
which hangs must not keep it from the client. None once the output
ended or the drain gave up.
Sourceasync fn recv_logging(
&mut self,
attach: &SharedContainerAttach,
rx: &mut Receiver<Message>,
) -> Logging
async fn recv_logging( &mut self, attach: &SharedContainerAttach, rx: &mut Receiver<Message>, ) -> Logging
Receive from rx while a read loop holds output on its way into the
log, until it took it or what is left of DRAIN_MAX_LOG_WAIT
passed, which gets logged here once. The output which is queued or
gets broadcast meanwhile comes first.
Sourcepub(crate) async fn recv_stdio(
&mut self,
rx: &Receiver<Message>,
) -> Option<Message>
pub(crate) async fn recv_stdio( &mut self, rx: &Receiver<Message>, ) -> Option<Message>
The next message of a stdio channel with Drain::recv. None once
the output ended, the channel got closed or the drain gave up.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Drain
impl RefUnwindSafe for Drain
impl Send for Drain
impl Sync for Drain
impl Unpin for Drain
impl UnsafeUnpin for Drain
impl UnwindSafe for Drain
Blanket Implementations§
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].