Skip to main content

AnalyticsStorage

Trait AnalyticsStorage 

Source
pub trait AnalyticsStorage: Send + Sync {
    // Required methods
    fn store_follower_snapshot<'life0, 'async_trait>(
        &'life0 self,
        followers: i64,
        following: i64,
        tweets: i64,
    ) -> Pin<Box<dyn Future<Output = Result<(), AnalyticsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_yesterday_followers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<i64>, AnalyticsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_replies_needing_measurement<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, AnalyticsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_tweets_needing_measurement<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, AnalyticsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn store_reply_performance<'life0, 'life1, 'async_trait>(
        &'life0 self,
        reply_id: &'life1 str,
        likes: i64,
        replies: i64,
        impressions: i64,
        score: f64,
    ) -> Pin<Box<dyn Future<Output = Result<(), AnalyticsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn store_tweet_performance<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tweet_id: &'life1 str,
        likes: i64,
        retweets: i64,
        replies: i64,
        impressions: i64,
        score: f64,
    ) -> Pin<Box<dyn Future<Output = Result<(), AnalyticsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_content_score<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        topic: &'life1 str,
        format: &'life2 str,
        score: f64,
    ) -> Pin<Box<dyn Future<Output = Result<(), AnalyticsError>> + 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<(), AnalyticsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided methods
    fn run_forge_sync_if_enabled<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ForgeSyncResult>, AnalyticsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn run_aggregations<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), AnalyticsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Storage operations for analytics data.

Required Methods§

Source

fn store_follower_snapshot<'life0, 'async_trait>( &'life0 self, followers: i64, following: i64, tweets: i64, ) -> Pin<Box<dyn Future<Output = Result<(), AnalyticsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Store a daily follower snapshot.

Source

fn get_yesterday_followers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<i64>, AnalyticsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get yesterday’s follower count (for drop detection).

Source

fn get_replies_needing_measurement<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, AnalyticsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get reply IDs posted approximately 24h ago that need performance measurement.

Source

fn get_tweets_needing_measurement<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, AnalyticsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get tweet IDs posted approximately 24h ago that need performance measurement.

Source

fn store_reply_performance<'life0, 'life1, 'async_trait>( &'life0 self, reply_id: &'life1 str, likes: i64, replies: i64, impressions: i64, score: f64, ) -> Pin<Box<dyn Future<Output = Result<(), AnalyticsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Store reply performance metrics.

Source

fn store_tweet_performance<'life0, 'life1, 'async_trait>( &'life0 self, tweet_id: &'life1 str, likes: i64, retweets: i64, replies: i64, impressions: i64, score: f64, ) -> Pin<Box<dyn Future<Output = Result<(), AnalyticsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Store tweet performance metrics.

Source

fn update_content_score<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, topic: &'life1 str, format: &'life2 str, score: f64, ) -> Pin<Box<dyn Future<Output = Result<(), AnalyticsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update the content score running average for a topic.

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<(), AnalyticsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Log an action.

Provided Methods§

Source

fn run_forge_sync_if_enabled<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<ForgeSyncResult>, AnalyticsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run Forge sync if the active content source has analytics sync enabled.

Returns Ok(Some(summary)) when sync ran, Ok(None) when disabled or not applicable, Err on failure.

Source

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

Run background aggregation jobs (best-times heatmap, reach snapshots).

Called at the end of each analytics iteration. Default is a no-op so existing impls don’t break.

Implementors§