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, ) -> RangeStreamPosition
Sourcepub fn at_origin(range_id: u64) -> RangeStreamPosition
pub fn at_origin(range_id: u64) -> RangeStreamPosition
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<RangeStreamPosition, 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 ==.impl StructuralPartialEq for RangeStreamPosition
Auto Trait Implementations§
impl Freeze for RangeStreamPosition
impl RefUnwindSafe for RangeStreamPosition
impl Send for RangeStreamPosition
impl Sync for RangeStreamPosition
impl Unpin for RangeStreamPosition
impl UnsafeUnpin for RangeStreamPosition
impl UnwindSafe for RangeStreamPosition
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request