Skip to main content

RangeStreamProgress

Struct RangeStreamProgress 

Source
pub struct RangeStreamProgress {
    pub range_id: u64,
    pub applied_lsn: u64,
    pub streamed_lsn: u64,
    pub primary_lsn: u64,
}
Expand description

Independent streaming progress for one range over the shared physical WAL.

All three LSNs are global WAL LSNs scoped to this range’s records: primary_lsn is the highest the primary has produced for the range, streamed_lsn the highest shipped to the follower, applied_lsn the highest the follower has durably applied. Their gaps give per-range lag that is independent of every other range riding the same WAL — the basis for per-range failover eligibility (issue #987).

Fields§

§range_id: u64§applied_lsn: u64§streamed_lsn: u64§primary_lsn: u64

Implementations§

Source§

impl RangeStreamProgress

Source

pub fn new(range_id: u64) -> Self

Source

pub fn apply_lag(&self) -> u64

Records this range still has to apply to match the primary frontier. Saturating so a follower transiently ahead of an observed frontier reports zero rather than underflowing.

Source

pub fn stream_lag(&self) -> u64

Records produced for this range that have not yet been shipped.

Source

pub fn is_caught_up(&self) -> bool

Whether the follower has applied everything the primary has produced for the range. False until a primary frontier has actually been observed, so an unknown range is never reported as caught up.

Source

pub fn failover_eligible(&self, max_lag: u64) -> bool

Whether this range is within max_lag records of the primary — a per-range gate a later failover decision can consult. Requires an observed primary frontier.

Source

pub fn encode_json(&self) -> Vec<u8>

Source

pub fn decode_json(bytes: &[u8]) -> Result<Self, ReplicationPayloadError>

Trait Implementations§

Source§

impl Clone for RangeStreamProgress

Source§

fn clone(&self) -> RangeStreamProgress

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RangeStreamProgress

Source§

impl Debug for RangeStreamProgress

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RangeStreamProgress

Source§

impl PartialEq for RangeStreamProgress

Source§

fn eq(&self, other: &RangeStreamProgress) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RangeStreamProgress

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.