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: u64Implementations§
Source§impl RangeStreamProgress
impl RangeStreamProgress
pub fn new(range_id: u64) -> Self
Sourcepub fn apply_lag(&self) -> u64
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.
Sourcepub fn stream_lag(&self) -> u64
pub fn stream_lag(&self) -> u64
Records produced for this range that have not yet been shipped.
Sourcepub fn is_caught_up(&self) -> bool
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.
Sourcepub fn failover_eligible(&self, max_lag: u64) -> bool
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.
pub fn encode_json(&self) -> Vec<u8> ⓘ
pub fn decode_json(bytes: &[u8]) -> Result<Self, ReplicationPayloadError>
Trait Implementations§
Source§impl Clone for RangeStreamProgress
impl Clone for RangeStreamProgress
Source§fn clone(&self) -> RangeStreamProgress
fn clone(&self) -> RangeStreamProgress
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 RangeStreamProgress
Source§impl Debug for RangeStreamProgress
impl Debug for RangeStreamProgress
impl Eq for RangeStreamProgress
Source§impl PartialEq for RangeStreamProgress
impl PartialEq for RangeStreamProgress
Source§fn eq(&self, other: &RangeStreamProgress) -> bool
fn eq(&self, other: &RangeStreamProgress) -> bool
self and other values to be equal, and is used by ==.