pub(super) struct Activity(Arc<Mutex<Instant>>);Expand description
When something last made progress, like a connection by what its client sent or got, or a container which took the stdin of a session. Clones share the time.
Tuple Fields§
§0: Arc<Mutex<Instant>>Implementations§
Source§impl Activity
impl Activity
Sourcepub(super) async fn idle(&self, timeout: Option<Duration>)
pub(super) async fn idle(&self, timeout: Option<Duration>)
Resolves once the connection was not active for the timeout. A timeout too large to represent is none, like no timeout.
Sourcepub(super) async fn until_idle<T>(
&self,
timeout: Option<Duration>,
run: impl Future<Output = T>,
on_idle: impl FnOnce(),
) -> Option<T>
pub(super) async fn until_idle<T>( &self, timeout: Option<Duration>, run: impl Future<Output = T>, on_idle: impl FnOnce(), ) -> Option<T>
Run run until it is done, or until the connection was not active
for the timeout, which gives None. on_idle runs before run gets
dropped then.
Sourcepub(super) async fn until_stalled<T>(
&self,
start: Instant,
timeout: Duration,
run: impl Future<Output = T>,
) -> Option<T>
pub(super) async fn until_stalled<T>( &self, start: Instant, timeout: Duration, run: impl Future<Output = T>, ) -> Option<T>
Run run until it is done, or until the activity was not touched
for the timeout, counted from start at the earliest, which gives
None. The writes of a connection touch it as they go out, which
lets the end of a connection take as long as a slow client needs,
see STALL_TIMEOUT.
Sourcepub(super) async fn until_stalled_or_idle<T>(
&self,
start: Instant,
timeout: Duration,
idle_timeout: Option<Duration>,
run: impl Future<Output = T>,
) -> Option<T>
pub(super) async fn until_stalled_or_idle<T>( &self, start: Instant, timeout: Duration, idle_timeout: Option<Duration>, run: impl Future<Output = T>, ) -> Option<T>
Like Self::until_stalled, but not before the activity was not
touched for the idle timeout either. A client which pauses the output,
like a pager, keeps the end as long as it kept the rest of a session,
one which ended for its idle timeout gets only the timeout, like
with an idle timeout too large for the clock.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Activity
impl RefUnwindSafe for Activity
impl Send for Activity
impl Sync for Activity
impl Unpin for Activity
impl UnsafeUnpin for Activity
impl UnwindSafe for Activity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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].