pub struct Checkpoint {Show 15 fields
pub job_id: String,
pub state: JobState,
pub source_system_id: String,
pub source_dbname: String,
pub slot: String,
pub publication: String,
pub slot_owned: bool,
pub consistent_point: Option<Lsn>,
pub commit_lsn: Lsn,
pub committed_lsn: Lsn,
pub acked_lsn: Lsn,
pub last_xid: Option<u32>,
pub last_commit_ts: Option<i64>,
pub txns_applied: u64,
pub last_error: Option<String>,
}Expand description
Everything needed to identify a job’s source and resume it safely.
Invariants maintained by the engine:
commit_lsn <= committed_lsn <= acked_lsn- the slot’s
confirmed_flush_lsnnever exceedsacked_lsn committed_lsnonly moves inside the target transaction that applied the data
Fields§
§job_id: String§state: JobState§source_system_id: StringIDENTIFY_SYSTEM.systemid of the source cluster.
source_dbname: String§slot: String§publication: String§slot_owned: boolWhether PGSync created the slot (and may therefore drop it in cleanup).
consistent_point: Option<Lsn>consistent_point returned at slot creation.
commit_lsn: Lsncommit_lsn of the last applied transaction (Begin.final_lsn of a redelivered
transaction is compared against this).
committed_lsn: Lsnend_lsn of the last applied transaction.
acked_lsn: LsnHighest position reported to the server as flushed.
last_xid: Option<u32>§last_commit_ts: Option<i64>PostgreSQL timestamp (µs since 2000-01-01) of the last applied commit.
txns_applied: u64§last_error: Option<String>Implementations§
Source§impl Checkpoint
impl Checkpoint
pub fn new_job( job_id: &str, source_system_id: &str, source_dbname: &str, slot: &str, publication: &str, ) -> Self
Sourcepub fn already_applied(&self, final_lsn: Lsn) -> bool
pub fn already_applied(&self, final_lsn: Lsn) -> bool
True when a transaction whose commit record is at final_lsn has already been
applied and must be skipped.
Sourcepub fn record_commit(
&mut self,
commit_lsn: Lsn,
end_lsn: Lsn,
xid: u32,
commit_ts: i64,
)
pub fn record_commit( &mut self, commit_lsn: Lsn, end_lsn: Lsn, xid: u32, commit_ts: i64, )
Record a transaction commit. Keeps the invariants.
Sourcepub fn record_keepalive(&mut self, wal_end: Lsn) -> bool
pub fn record_keepalive(&mut self, wal_end: Lsn) -> bool
Record a keepalive position as safe to acknowledge. Returns true if it advanced.
pub fn check_invariants(&self) -> Result<(), String>
Trait Implementations§
Source§impl Clone for Checkpoint
impl Clone for Checkpoint
Source§impl Debug for Checkpoint
impl Debug for Checkpoint
Source§impl<'de> Deserialize<'de> for Checkpoint
impl<'de> Deserialize<'de> for Checkpoint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Checkpoint
Source§impl PartialEq for Checkpoint
impl PartialEq for Checkpoint
Source§impl Serialize for Checkpoint
impl Serialize for Checkpoint
impl StructuralPartialEq for Checkpoint
Auto Trait Implementations§
impl Freeze for Checkpoint
impl RefUnwindSafe for Checkpoint
impl Send for Checkpoint
impl Sync for Checkpoint
impl Unpin for Checkpoint
impl UnsafeUnpin for Checkpoint
impl UnwindSafe for Checkpoint
Blanket Implementations§
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.