Skip to main content

Drain

Struct Drain 

Source
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: Duration

How long the drain waited for the log drivers so far, see Drain::recv_attach.

Implementations§

Source§

impl Drain

Source

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.

Source

fn take(&mut self) -> bool

Account for the next message, false once DRAIN_MAX_MESSAGES got forwarded, which gets logged here.

Source

pub(crate) fn exhausted(&self) -> bool

Whether the drain forwarded or waited as much as it may.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl Default for Drain

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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

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,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

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.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

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

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