Skip to main content

AnalyticsStore

Trait AnalyticsStore 

Source
pub trait AnalyticsStore: Send + Sync {
    // Required methods
    fn record(&self, event: SelectionEvent) -> Result<(), LearnError>;
    fn query_recent(
        &self,
        limit: usize,
    ) -> Result<Vec<SelectionEvent>, LearnError>;
    fn query_by_skill(
        &self,
        skill: &SkillName,
        limit: usize,
    ) -> Result<Vec<SelectionEvent>, LearnError>;
    fn count(&self) -> Result<usize, LearnError>;
}
Expand description

Trait for analytics storage backends.

Required Methods§

Source

fn record(&self, event: SelectionEvent) -> Result<(), LearnError>

Record a selection event.

Source

fn query_recent(&self, limit: usize) -> Result<Vec<SelectionEvent>, LearnError>

Query recent events.

Source

fn query_by_skill( &self, skill: &SkillName, limit: usize, ) -> Result<Vec<SelectionEvent>, LearnError>

Query events for a specific skill.

Source

fn count(&self) -> Result<usize, LearnError>

Get event count.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl AnalyticsStore for InMemoryAnalyticsStore

Source§

impl AnalyticsStore for SqliteAnalyticsStore

Available on crate feature analytics-sqlite only.