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.
pub fn encode_json(&self) -> Vec<u8> ⓘ
pub fn decode_json(bytes: &[u8]) -> Result<Self, ReplicationPayloadError>
Trait Implementations§
Source§impl Clone for RangeStreamPosition
impl Clone for RangeStreamPosition
Source§fn clone(&self) -> RangeStreamPosition
fn clone(&self) -> RangeStreamPosition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RangeStreamPosition
Source§impl Debug for RangeStreamPosition
impl Debug for RangeStreamPosition
impl Eq for RangeStreamPosition
Source§impl PartialEq for RangeStreamPosition
impl PartialEq for RangeStreamPosition
Source§fn eq(&self, other: &RangeStreamPosition) -> bool
fn eq(&self, other: &RangeStreamPosition) -> bool
self and other values to be equal, and is used by ==.