pub struct ExpirationManager { /* private fields */ }Expand description
The expiration manager is resposible for revoking and renewing leases.
Implementations§
Source§impl ExpirationManager
impl ExpirationManager
Sourcepub fn new(router: Arc<Router>, repos: Repos, clock: impl Clock) -> Self
pub fn new(router: Arc<Router>, repos: Repos, clock: impl Clock) -> Self
Create a new expiration manager.
Sourcepub async fn register(&self, le: LeaseEntry) -> Result<(), Error>
pub async fn register(&self, le: LeaseEntry) -> Result<(), Error>
Register a new LeaseEntry.
This is the only way to register new leases, leases should not be inserted
directly to the [LeaseStore] without going throught the expiration manager.
Sourcepub async fn revoke_leases_by_mount_prefix(
&self,
prefix: &str,
namespace_id: &str,
) -> Result<Vec<LeaseEntry>, Error>
pub async fn revoke_leases_by_mount_prefix( &self, prefix: &str, namespace_id: &str, ) -> Result<Vec<LeaseEntry>, Error>
Revoke all leases issued by mounts under a given path prefix.
Sourcepub async fn list_by_mount_prefix(
&self,
prefix: &str,
namespace_id: &str,
) -> Result<Vec<LeaseEntry>, Error>
pub async fn list_by_mount_prefix( &self, prefix: &str, namespace_id: &str, ) -> Result<Vec<LeaseEntry>, Error>
List all leases issued by mounts under a given path prefix.
Sourcepub async fn lookup(
&self,
lease_id: &str,
namespace_id: &str,
) -> Result<Option<LeaseEntry>, Error>
pub async fn lookup( &self, lease_id: &str, namespace_id: &str, ) -> Result<Option<LeaseEntry>, Error>
Lookup a lease by its id.
Sourcepub async fn revoke_lease_entry_by_id(
&self,
lease_id: &str,
namespace_id: &str,
) -> Result<LeaseEntry, Error>
pub async fn revoke_lease_entry_by_id( &self, lease_id: &str, namespace_id: &str, ) -> Result<LeaseEntry, Error>
Revoke a lease by its id.
Sourcepub async fn renew_lease_entry(
&self,
lease_id: &str,
namespace_id: &str,
ttl: Option<Duration>,
) -> Result<LeaseEntry, Error>
pub async fn renew_lease_entry( &self, lease_id: &str, namespace_id: &str, ttl: Option<Duration>, ) -> Result<LeaseEntry, Error>
Renew a lease by its id.
Auto Trait Implementations§
impl !Freeze for ExpirationManager
impl !RefUnwindSafe for ExpirationManager
impl Send for ExpirationManager
impl Sync for ExpirationManager
impl Unpin for ExpirationManager
impl !UnwindSafe for ExpirationManager
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 more