Skip to main content

FileBackend

Trait FileBackend 

Source
pub trait FileBackend: Send + Sync {
    // Required methods
    fn save<'life0, 'life1, 'async_trait>(
        &'life0 self,
        entries: &'life1 [MemoryEntry],
    ) -> Pin<Box<dyn Future<Output = Layer3Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save_with_session<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        entries: &'life2 [MemoryEntry],
    ) -> Pin<Box<dyn Future<Output = Layer3Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn load<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<MemoryEntry>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn load_container<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<StorageContainer>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn exists<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clear<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn path(&self) -> &Path;

    // Provided method
    fn version(&self) -> u32 { ... }
}
Expand description

File backend trait for session persistence

Required Methods§

Source

fn save<'life0, 'life1, 'async_trait>( &'life0 self, entries: &'life1 [MemoryEntry], ) -> Pin<Box<dyn Future<Output = Layer3Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save entries to file with atomic write

Source

fn save_with_session<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session_id: &'life1 str, entries: &'life2 [MemoryEntry], ) -> Pin<Box<dyn Future<Output = Layer3Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Save with session ID for container

Source

fn load<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<MemoryEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load entries from file

Source

fn load_container<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Layer3Result<StorageContainer>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load full storage container

Source

fn exists<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if backend file exists

Source

fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Layer3Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Clear backend storage

Source

fn path(&self) -> &Path

Get backend path

Provided Methods§

Source

fn version(&self) -> u32

Get storage version

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§