Skip to main content

RuntimeLeaseStore

Trait RuntimeLeaseStore 

Source
pub trait RuntimeLeaseStore:
    Send
    + Sync
    + 'static {
    type Error: Display + Send + Sync + 'static;

    // Required methods
    fn try_acquire<'life0, 'life1, 'async_trait>(
        &'life0 self,
        claim: RuntimeLeaseClaim<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<RuntimeLeaseAcquire, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn renew<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        lease_id: &'life1 str,
        owner_id: &'life2 str,
        now: DateTime<Utc>,
        expires_at: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn release<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        lease_id: &'life1 str,
        owner_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Store contract used by runtime lease supervisors.

Required Associated Types§

Source

type Error: Display + Send + Sync + 'static

Store error type.

Required Methods§

Source

fn try_acquire<'life0, 'life1, 'async_trait>( &'life0 self, claim: RuntimeLeaseClaim<'life1>, ) -> Pin<Box<dyn Future<Output = Result<RuntimeLeaseAcquire, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Attempts to acquire the lease for the caller.

Source

fn renew<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, lease_id: &'life1 str, owner_id: &'life2 str, now: DateTime<Utc>, expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Renews an owned lease and returns whether ownership was still held.

Source

fn release<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, lease_id: &'life1 str, owner_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Releases an owned lease during cooperative shutdown.

Implementors§