Skip to main content

PluginStore

Trait PluginStore 

Source
pub trait PluginStore: Send + Sync {
    // Required methods
    fn get<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        vault: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = PluginResult<Option<Vec<u8>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        vault: &'life1 str,
        key: &'life2 str,
        value: &'life3 [u8],
    ) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        vault: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        vault: &'life1 str,
        prefix: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = PluginResult<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Host implementation behind PluginStorage.

The trait is public so plugin crates can provide in-memory fakes in their own tests. Keys reaching an implementation have already been validated by PluginStorage, and namespacing is the host’s responsibility.

Required Methods§

Source

fn get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, vault: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = PluginResult<Option<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Read a value, or None when the key was never written.

Source

fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, vault: &'life1 str, key: &'life2 str, value: &'life3 [u8], ) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Write a value, replacing any previous one.

Source

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

Remove a value. Removing a key that does not exist succeeds.

Source

fn list<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, vault: &'life1 str, prefix: &'life2 str, ) -> Pin<Box<dyn Future<Output = PluginResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

List keys beginning with prefix, sorted. An empty prefix lists all.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§