pub struct IdleTracker { /* private fields */ }Expand description
Tracks daemon activity so an unused daemon shuts itself down.
A daemon is idle when no connection is open and the last completed
request is older than the configured timeout. None disables idle
shutdown entirely (--foreground, or idle_timeout_secs = 0).
Implementations§
Source§impl IdleTracker
impl IdleTracker
pub fn new(timeout: Option<Duration>) -> Self
Sourcepub fn new_at(timeout: Option<Duration>, start: Instant) -> Self
pub fn new_at(timeout: Option<Duration>, start: Instant) -> Self
Construct with an explicit start instant (used by tests).
Sourcepub fn is_idle_at(&self, now: Instant) -> bool
pub fn is_idle_at(&self, now: Instant) -> bool
True when the daemon has been unused for longer than the timeout.
Sourcepub fn poll_interval(&self) -> Duration
pub fn poll_interval(&self) -> Duration
How often the accept loop should re-check idleness.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for IdleTracker
impl RefUnwindSafe for IdleTracker
impl Send for IdleTracker
impl Sync for IdleTracker
impl Unpin for IdleTracker
impl UnsafeUnpin for IdleTracker
impl UnwindSafe for IdleTracker
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request