pub trait Sequencer: Send + Sync {
type Meta: Send + Sync;
// Required methods
fn commit(
&self,
batches: &[CommitBatch<'_, Self::Meta>],
) -> Result<Vec<CommitOutcome>, ObjectLogError>;
fn lookup(
&self,
partition: &PartitionKey,
fetch_offset: i64,
) -> Result<Vec<IndexEntry>, ObjectLogError>;
fn high_watermark(
&self,
partition: &PartitionKey,
) -> Result<i64, ObjectLogError>;
fn log_start_offset(
&self,
partition: &PartitionKey,
) -> Result<i64, ObjectLogError>;
fn truncate_before(
&self,
partition: &PartitionKey,
offset: i64,
) -> Result<Vec<String>, ObjectLogError>;
}Expand description
The linearization point: assigns offsets to durably-stored batches and owns the offset→location index.
Synchronous on purpose — a lin-point is a critical section, not async I/O.
The engine calls it from its flush worker (a dedicated thread / blocking
task), so a blocking implementation (a Mutex, a SQL transaction) is fine.
Contract: commit is atomic across the whole slice
(all batches in one object commit together or not at all), and the engine
presents batches for any single PartitionKey in arrival order and never
splits one partition across concurrent commit calls.
Required Associated Types§
Required Methods§
Sourcefn commit(
&self,
batches: &[CommitBatch<'_, Self::Meta>],
) -> Result<Vec<CommitOutcome>, ObjectLogError>
fn commit( &self, batches: &[CommitBatch<'_, Self::Meta>], ) -> Result<Vec<CommitOutcome>, ObjectLogError>
Assign offsets to a just-PUT object’s batches and persist the index.
Returns one CommitOutcome per input batch, in order. Atomic: on Err,
nothing is committed.
Sourcefn lookup(
&self,
partition: &PartitionKey,
fetch_offset: i64,
) -> Result<Vec<IndexEntry>, ObjectLogError>
fn lookup( &self, partition: &PartitionKey, fetch_offset: i64, ) -> Result<Vec<IndexEntry>, ObjectLogError>
Resolve fetch_offset to the ordered index entries covering it onward.
Sourcefn high_watermark(
&self,
partition: &PartitionKey,
) -> Result<i64, ObjectLogError>
fn high_watermark( &self, partition: &PartitionKey, ) -> Result<i64, ObjectLogError>
The next offset to be assigned (index-only; no object reads).
Sourcefn log_start_offset(
&self,
partition: &PartitionKey,
) -> Result<i64, ObjectLogError>
fn log_start_offset( &self, partition: &PartitionKey, ) -> Result<i64, ObjectLogError>
The first readable offset (advances on truncate_before).
Sourcefn truncate_before(
&self,
partition: &PartitionKey,
offset: i64,
) -> Result<Vec<String>, ObjectLogError>
fn truncate_before( &self, partition: &PartitionKey, offset: i64, ) -> Result<Vec<String>, ObjectLogError>
Retention MECHANISM (not policy): drop index entries below offset and
return object ids that now have no live references from any
partition (objects are multiplexed and shared), for the engine to delete.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".