pub struct ManagedLeaseFactory { /* private fields */ }Expand description
Managed lease factory that will create a new lease and keep it alive until it is dropped.
Implementations§
Source§impl ManagedLeaseFactory
impl ManagedLeaseFactory
Sourcepub fn spawn(etcd: Client) -> (Self, JoinHandle<()>)
pub fn spawn(etcd: Client) -> (Self, JoinHandle<()>)
Create a new managed lease factory. This will spawn a new task that will handle the lease creation and keep alive.
Sourcepub fn spawn_on(etcd: Client, rt: Handle) -> (Self, JoinHandle<()>)
pub fn spawn_on(etcd: Client, rt: Handle) -> (Self, JoinHandle<()>)
Create a new managed lease factory. This will spawn a new task that will handle the lease creation and keep alive.
Arguments:
etcd- The etcd client to use.rt- The runtime handle to spawn tasks on.
Sourcepub async fn new_lease_with_auto_refresh_limit(
&self,
ttl: Duration,
keepalive_interval: Option<Duration>,
auto_refresh_limit: Option<usize>,
) -> Result<ManagedLease, Error>
pub async fn new_lease_with_auto_refresh_limit( &self, ttl: Duration, keepalive_interval: Option<Duration>, auto_refresh_limit: Option<usize>, ) -> Result<ManagedLease, Error>
Create a new managed lease with the given time-to-live (TTL), keepalive interval and auto refresh limit.
The lease will be kept alive until it is dropped OR until the lease has been refresh auto_refresh_limit times.
Arguments:
ttl- The time-to-live for the lease.keepalive_interval- The interval to keep the lease alive.auto_refresh_limit- The number of times to auto refresh the lease.
Sourcepub async fn new_lease(
&self,
ttl: Duration,
keepalive_interval: Option<Duration>,
) -> Result<ManagedLease, Error>
pub async fn new_lease( &self, ttl: Duration, keepalive_interval: Option<Duration>, ) -> Result<ManagedLease, Error>
Create a new managed lease with the given time-to-live (TTL) and keepalive interval.
Managed lease have automatic keep alive mechanism that will keep the lease alive until it is dropped.
The ttl must be at least two (2) seconds.
Keepalive interval is optional, if not provided it will be half of the ttl.
Arguments:
ttl- The time-to-live for the lease.keepalive_interval- The interval to keep the lease alive.
Trait Implementations§
Source§impl Clone for ManagedLeaseFactory
impl Clone for ManagedLeaseFactory
Source§fn clone(&self) -> ManagedLeaseFactory
fn clone(&self) -> ManagedLeaseFactory
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ManagedLeaseFactory
impl RefUnwindSafe for ManagedLeaseFactory
impl Send for ManagedLeaseFactory
impl Sync for ManagedLeaseFactory
impl Unpin for ManagedLeaseFactory
impl UnsafeUnpin for ManagedLeaseFactory
impl UnwindSafe for ManagedLeaseFactory
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request