Skip to main content

HandleStore

Trait HandleStore 

Source
pub trait HandleStore: Send + Sync {
    // Required methods
    fn put<'life0, 'async_trait>(
        &'life0 self,
        record: HandleRecord,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        create_guid: &'life1 Guid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<HandleRecord>, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn take<'life0, 'life1, 'async_trait>(
        &'life0 self,
        create_guid: &'life1 Guid,
        match_guid: Option<Guid>,
        now_ms: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Option<HandleRecord>, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn reclaim<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        create_guid: &'life1 Guid,
        owner: &'life2 str,
        now_ms: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Option<HandleRecord>, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        create_guid: &'life1 Guid,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn sweep_expired<'life0, 'async_trait>(
        &'life0 self,
        now_ms: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Guid>, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<HandleRecord>, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Backend-agnostic durable/persistent handle registry.

Implementations must make reclaim atomic so two nodes cannot both win the same handle during failover.

Required Methods§

Source

fn put<'life0, 'async_trait>( &'life0 self, record: HandleRecord, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Insert or replace a handle record (durable grant).

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, create_guid: &'life1 Guid, ) -> Pin<Box<dyn Future<Output = Result<Option<HandleRecord>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch a handle record by its create GUID.

Source

fn take<'life0, 'life1, 'async_trait>( &'life0 self, create_guid: &'life1 Guid, match_guid: Option<Guid>, now_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<HandleRecord>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Atomically validate and remove a handle for a durable reconnect ([MS-SMB2] §3.3.5.9.7): the record must exist, be unexpired, and — when match_guid is Some (v2 reconnect) — carry the same client guid. Returns the removed record on success, else None.

Source

fn reclaim<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, create_guid: &'life1 Guid, owner: &'life2 str, now_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<HandleRecord>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically claim a handle for owner when it is free, already owned by owner, or expired. Returns the (now owned) record, or None if it is still validly owned by another node. Reclaim renews the deadline.

Source

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, create_guid: &'life1 Guid, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a handle record (close or durable expiry).

Source

fn sweep_expired<'life0, 'async_trait>( &'life0 self, now_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<Guid>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Drop every non-persistent handle whose deadline has passed; returns the GUIDs removed so the caller can release their backing resources.

Source

fn list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<HandleRecord>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

All live handle records (diagnostics / reconciliation).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§