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§
fn describe(&self) -> EventLogDescription
async fn append( &self, topic: &Topic, event: LogEvent, ) -> Result<EventId, LogError>
async fn flush(&self) -> Result<(), LogError>
Sourceasync fn read_range(
&self,
topic: &Topic,
from: Option<EventId>,
limit: usize,
) -> Result<Vec<(EventId, LogEvent)>, LogError>
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.
Sourceasync fn subscribe(
self: Arc<Self>,
topic: &Topic,
from: Option<EventId>,
) -> Result<BoxStream<'static, Result<(EventId, LogEvent), LogError>>, LogError>
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>.
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 Methods§
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".