pub struct RangeStreamPosition {
pub range_id: u64,
pub applied_lsn: u64,
pub accepted_term: u64,
pub accepted_epoch: u64,
}Expand description
The per-range resume position and authority watermark a range follower
persists. A range replica restarting catch-up hands the primary this
position so streaming resumes from applied_lsn for the range instead of
replaying the whole shared WAL, and so the follower keeps fencing records
from a deposed owner.
applied_lsn is a global WAL LSN — the highest LSN this follower has
applied for this range. Because the range’s records are sparse within
the shared sequential log, range catch-up admits any record with a strictly
greater LSN (range-local monotonicity) rather than requiring the global
lsn == last + 1 contiguity the whole-stream applier enforces.
Fields§
§range_id: u64§applied_lsn: u64§accepted_term: u64§accepted_epoch: u64Implementations§
Source§impl RangeStreamPosition
impl RangeStreamPosition
pub fn new( range_id: u64, applied_lsn: u64, accepted_term: u64, accepted_epoch: u64, ) -> Self
Sourcepub fn at_origin(range_id: u64) -> Self
pub fn at_origin(range_id: u64) -> Self
A fresh follower for range_id that has applied nothing yet and holds
the lowest possible authority watermark (accepts any term/epoch).
The authority fence this position currently enforces. A record stamped for this range whose term or ownership epoch is below the watermark is a write from a stale timeline or deposed owner and is rejected.
Sourcepub fn advance(&mut self, record: &ChangeRecord)
pub fn advance(&mut self, record: &ChangeRecord)
Advance this position past an admitted record that belongs to the range. The resume LSN moves forward and the authority watermark ratchets up to the record’s term/epoch so a later stale write cannot slip back in. Only records stamped for this range and ahead of the current resume LSN move the position; everything else leaves it untouched.