Skip to main content

LoopStorage

Trait LoopStorage 

Source
pub trait LoopStorage: Send + Sync {
    // Required methods
    fn get_cursor<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, LoopError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_cursor<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        value: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), LoopError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn tweet_exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tweet_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, LoopError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn store_discovered_tweet<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tweet: &'life1 LoopTweet,
        score: f32,
        keyword: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), LoopError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn log_action<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        action_type: &'life1 str,
        status: &'life2 str,
        message: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), LoopError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Port for persisting loop state (since_id, discovered tweets, action log).

Required Methods§

Source

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

Get a persisted cursor value (e.g., since_id for mentions).

Source

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

Set a persisted cursor value.

Source

fn tweet_exists<'life0, 'life1, 'async_trait>( &'life0 self, tweet_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, LoopError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a discovered tweet already exists (dedup by tweet ID).

Source

fn store_discovered_tweet<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tweet: &'life1 LoopTweet, score: f32, keyword: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), LoopError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Store a discovered tweet with its score and matched keyword.

Source

fn log_action<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, action_type: &'life1 str, status: &'life2 str, message: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), LoopError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Log an action (for audit trail and status reporting).

Implementors§