Skip to main content

StampSource

Trait StampSource 

Source
pub trait StampSource:
    Debug
    + Send
    + Sync {
    // Required method
    fn next_stamp(&self) -> u64;

    // Provided method
    fn observe(&self, _stamp: u64) { ... }
}
Expand description

A source of monotonic internal stamps folded into a partition’s .stampindex.

The log calls StampSource::next_stamp for each non-transactional batch at append time and for each pure-Kafka transaction when its commit marker is durable. A cross-domain coordinator supplies its own commit stamp, which the log folds into this source with StampSource::observe.

Implementations use interior mutability, because the log holds the source behind a shared Arc and stamps through &mut self appends. They must be cheap. They must never read or alter the wire-exact .log bytes, the offset assignment, the LSO, or the high-watermark. The stamp is an additional server-side coordinate only.

Required Methods§

Source

fn next_stamp(&self) -> u64

Return the next stamp.

Provided Methods§

Source

fn observe(&self, _stamp: u64)

Fold an externally allocated commit stamp into this source so every later allocation is greater than it.

Centralized sources can keep the default no-op because they are the sole timestamp authority. Distributed clocks override this with their Lamport/HLC receive rule.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§