pub struct PtsState {
pub pts: i32,
pub qts: i32,
pub date: i32,
pub seq: i32,
pub channel_pts: HashMap<i64, i32>,
pub last_update_at: Option<Instant>,
}Expand description
Full MTProto sequence-number state, including per-channel counters.
All fields are pub so that connect() can restore them from the
persisted session without going through an artificial constructor.
Fields§
§pts: i32Main pts counter (messages, non-channel updates).
qts: i32G-18: Secondary counter for secret-chat updates.
date: i32Date of the last received update (Unix timestamp).
seq: i32G-19: Combined-container sequence number.
channel_pts: HashMap<i64, i32>Per-channel pts counters. channel_id → pts.
last_update_at: Option<Instant>G-16: Timestamp of last received update for deadline-based gap detection.
Implementations§
Source§impl PtsState
impl PtsState
pub fn from_server_state(s: &State) -> Self
Sourcepub fn deadline_exceeded(&self) -> bool
pub fn deadline_exceeded(&self) -> bool
G-16: Returns true if no update has been received for > 15 minutes.
Sourcepub fn check_pts(&self, new_pts: i32, pts_count: i32) -> PtsCheckResult
pub fn check_pts(&self, new_pts: i32, pts_count: i32) -> PtsCheckResult
Check whether new_pts is in order given pts_count new updates.
Sourcepub fn check_qts(&self, new_qts: i32, qts_count: i32) -> PtsCheckResult
pub fn check_qts(&self, new_qts: i32, qts_count: i32) -> PtsCheckResult
G-18: Check a qts value (secret chat updates).
Sourcepub fn check_seq(&self, _new_seq: i32, seq_start: i32) -> PtsCheckResult
pub fn check_seq(&self, _new_seq: i32, seq_start: i32) -> PtsCheckResult
G-19: Check top-level seq for UpdatesCombined containers.
Sourcepub fn check_channel_pts(
&self,
channel_id: i64,
new_pts: i32,
pts_count: i32,
) -> PtsCheckResult
pub fn check_channel_pts( &self, channel_id: i64, new_pts: i32, pts_count: i32, ) -> PtsCheckResult
Check a per-channel pts value.
Sourcepub fn advance_qts(&mut self, new_qts: i32)
pub fn advance_qts(&mut self, new_qts: i32)
Advance the qts (G-18).
Sourcepub fn advance_seq(&mut self, new_seq: i32)
pub fn advance_seq(&mut self, new_seq: i32)
Advance seq (G-19).
Sourcepub fn advance_channel(&mut self, channel_id: i64, new_pts: i32)
pub fn advance_channel(&mut self, channel_id: i64, new_pts: i32)
Advance a per-channel pts.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PtsState
impl RefUnwindSafe for PtsState
impl Send for PtsState
impl Sync for PtsState
impl Unpin for PtsState
impl UnsafeUnpin for PtsState
impl UnwindSafe for PtsState
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,
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 more