Skip to main content

RemoteLockProvider

Trait RemoteLockProvider 

Source
pub trait RemoteLockProvider:
    Send
    + Sync
    + 'static {
    // Required methods
    fn try_remote_lock<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        owner_token: &'life2 str,
        timeout_millis: u64,
        expire_millis: u64,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn unlock_remote<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        owner_token: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Provider-neutral distributed lock boundary.

Implementations must associate an acquired lock with owner_token and release it only while that token still owns the key. A zero timeout is one non-blocking attempt; a zero expiry means no automatic lease expiry.

Required Methods§

Source

fn try_remote_lock<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, owner_token: &'life2 str, timeout_millis: u64, expire_millis: u64, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn unlock_remote<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, owner_token: &'life2 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§