Skip to main content

EventStore

Trait EventStore 

Source
pub trait EventStore: Send + Sync {
    // Required methods
    fn append<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 EventData,
    ) -> Pin<Box<dyn Future<Output = WaeResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn append_batch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        events: &'life1 [EventData],
    ) -> Pin<Box<dyn Future<Output = WaeResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_events<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event_type: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = WaeResult<Vec<EventData>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_events_by_time<'life0, 'async_trait>(
        &'life0 self,
        start: u64,
        end: u64,
    ) -> Pin<Box<dyn Future<Output = WaeResult<Vec<EventData>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_all_events<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = WaeResult<Vec<EventData>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = WaeResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clear<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = WaeResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

事件存储 trait

定义事件持久化存储的接口。

Required Methods§

Source

fn append<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 EventData, ) -> Pin<Box<dyn Future<Output = WaeResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

追加事件到存储

Source

fn append_batch<'life0, 'life1, 'async_trait>( &'life0 self, events: &'life1 [EventData], ) -> Pin<Box<dyn Future<Output = WaeResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

批量追加事件

Source

fn get_events<'life0, 'life1, 'async_trait>( &'life0 self, event_type: &'life1 str, ) -> Pin<Box<dyn Future<Output = WaeResult<Vec<EventData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

获取指定类型的事件流

Source

fn get_events_by_time<'life0, 'async_trait>( &'life0 self, start: u64, end: u64, ) -> Pin<Box<dyn Future<Output = WaeResult<Vec<EventData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

获取指定时间范围的事件

Source

fn get_all_events<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = WaeResult<Vec<EventData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

获取所有事件

Source

fn count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = WaeResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

获取事件数量

Source

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

清空所有事件

Implementors§