Skip to main content

ResilienceStore

Trait ResilienceStore 

Source
pub trait ResilienceStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn incr<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<i64, ResilienceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn get_i64<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<i64>, ResilienceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn set_ex<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        val: i64,
        ttl_seconds: usize,
    ) -> Pin<Box<dyn Future<Output = Result<(), ResilienceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn del<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), ResilienceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn eval_lua<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
        &'life0 self,
        script: &'life1 str,
        keys: &'life2 [&'life3 str],
        args: &'life4 [&'life5 str],
    ) -> Pin<Box<dyn Future<Output = Result<LuaValue, ResilienceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait,
             Self: 'async_trait;
}
Expand description

Minimal distributed key-value operations used by resilience backends.

Implement this trait to allow the framework to store counters, flags and execute Lua scripts atomically in a backing store (e.g., Redis).

Required Methods§

Source

fn incr<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<i64, ResilienceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn get_i64<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<i64>, ResilienceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn set_ex<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, val: i64, ttl_seconds: usize, ) -> Pin<Box<dyn Future<Output = Result<(), ResilienceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn del<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ResilienceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn eval_lua<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, script: &'life1 str, keys: &'life2 [&'life3 str], args: &'life4 [&'life5 str], ) -> Pin<Box<dyn Future<Output = Result<LuaValue, ResilienceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Self: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§