Skip to main content

LogView

Trait LogView 

Source
pub trait LogView {
    // Required methods
    fn end_offset(&self) -> i64;
    fn last_epoch(&self) -> u32;
    fn end_offset_for_epoch(&self, epoch: u32) -> LogOffsetMetadata;
}
Expand description

Read-only view of the local replicated log that the state machine uses.

Production uses the real krabka-log-backed implementation; tests supply a fake.

Required Methods§

Source

fn end_offset(&self) -> i64

The log end offset: one offset after the last appended record.

Source

fn last_epoch(&self) -> u32

Leader epoch of the last appended record. An empty log gives 0.

Source

fn end_offset_for_epoch(&self, epoch: u32) -> LogOffsetMetadata

Kafka’s RaftLog.endOffsetForEpoch: the largest epoch <= epoch that this log holds, and the offset where that epoch ends.

The end is the start offset of the first epoch newer than epoch, or the log end when there is none. An epoch older than every epoch in the log answers epoch itself with the start of the oldest one. An epoch newer than every epoch in the log answers the log end and last_epoch, which never equals epoch, so the leader treats a fetch at that epoch as diverging.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§