Skip to main content

EventLog

Trait EventLog 

Source
pub trait EventLog: Send + Sync {
    // Required methods
    fn describe(&self) -> EventLogDescription;
    async fn append(
        &self,
        topic: &Topic,
        event: LogEvent,
    ) -> Result<EventId, LogError>;
    async fn flush(&self) -> Result<(), LogError>;
    async fn read_range(
        &self,
        topic: &Topic,
        from: Option<EventId>,
        limit: usize,
    ) -> Result<Vec<(EventId, LogEvent)>, LogError>;
    async fn subscribe(
        self: Arc<Self>,
        topic: &Topic,
        from: Option<EventId>,
    ) -> Result<BoxStream<'static, Result<(EventId, LogEvent), LogError>>, LogError>;
    async fn ack(
        &self,
        topic: &Topic,
        consumer: &ConsumerId,
        up_to: EventId,
    ) -> Result<(), LogError>;
    async fn consumer_cursor(
        &self,
        topic: &Topic,
        consumer: &ConsumerId,
    ) -> Result<Option<EventId>, LogError>;
    async fn latest(&self, topic: &Topic) -> Result<Option<EventId>, LogError>;
    async fn compact(
        &self,
        topic: &Topic,
        before: EventId,
    ) -> Result<CompactReport, LogError>;

    // Provided method
    async fn read_range_bytes(
        &self,
        topic: &Topic,
        from: Option<EventId>,
        limit: usize,
    ) -> Result<Vec<(EventId, LogEventBytes)>, LogError> { ... }
}

Required Methods§

Source

fn describe(&self) -> EventLogDescription

Source

async fn append( &self, topic: &Topic, event: LogEvent, ) -> Result<EventId, LogError>

Source

async fn flush(&self) -> Result<(), LogError>

Source

async fn read_range( &self, topic: &Topic, from: Option<EventId>, limit: usize, ) -> Result<Vec<(EventId, LogEvent)>, LogError>

Read events strictly after from. None starts from the beginning of the topic.

Source

async fn subscribe( self: Arc<Self>, topic: &Topic, from: Option<EventId>, ) -> Result<BoxStream<'static, Result<(EventId, LogEvent), LogError>>, LogError>

async fn keeps the ergonomic generic surface; the boxed stream preserves dyn-dispatch for callers that store Arc<dyn EventLog>.

Source

async fn ack( &self, topic: &Topic, consumer: &ConsumerId, up_to: EventId, ) -> Result<(), LogError>

Source

async fn consumer_cursor( &self, topic: &Topic, consumer: &ConsumerId, ) -> Result<Option<EventId>, LogError>

Source

async fn latest(&self, topic: &Topic) -> Result<Option<EventId>, LogError>

Source

async fn compact( &self, topic: &Topic, before: EventId, ) -> Result<CompactReport, LogError>

Provided Methods§

Source

async fn read_range_bytes( &self, topic: &Topic, from: Option<EventId>, limit: usize, ) -> Result<Vec<(EventId, LogEventBytes)>, LogError>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§