Skip to main content

PositionComparator

Trait PositionComparator 

Source
pub trait PositionComparator: Send + Sync {
    // Required method
    fn position_reached(&self, event_pos: &Bytes, resume_pos: &Bytes) -> bool;
}
Expand description

Position comparison trait for per-subscriber replay filtering Trait for comparing source positions during per-subscriber replay filtering.

When a source rewinds to serve a late-joining subscriber, events that a subscriber has already committed must be suppressed. Since source_position is opaque bytes, the framework cannot compare them directly — the source must provide the comparison logic.

§Contract

position_reached(event_pos, resume_pos) returns true when the event at event_pos is strictly after resume_pos (i.e., it is new for a subscriber that last committed at resume_pos). Events at or before the resume position are filtered out.

§Default

ByteLexPositionComparator provides a byte-lexicographic comparison that works for any position encoded in big-endian (e.g., Postgres u64 LSN, MSSQL 20-byte LSN).

Required Methods§

Source

fn position_reached(&self, event_pos: &Bytes, resume_pos: &Bytes) -> bool

Returns true if event_pos is strictly after resume_pos.

Implementors§