Skip to main content

RuleStateStore

Trait RuleStateStore 

Source
pub trait RuleStateStore:
    Send
    + Sync
    + Debug {
    // Required methods
    fn increment_counter<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        window: Duration,
    ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_variable<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_variable<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        value: String,
        ttl: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn increment_counter<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, window: Duration, ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Increment a counter for the given key. Returns the new value. The window parameter suggests a time window for rate limiting, but in this simple interface it might just set the TTL for the key if it’s new.

Source

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

Source

fn set_variable<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, value: String, ttl: Option<Duration>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§