pub struct ReadYourWritesTracker { /* private fields */ }Expand description
Read-Your-Writes Tracker
Tracks the last write LSN per session to ensure reads are routed to replicas that have replayed past that point.
Implementations§
Source§impl ReadYourWritesTracker
impl ReadYourWritesTracker
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default retention (5 minutes)
Sourcepub fn record_write(&self, session_id: &str, lsn: u64)
pub fn record_write(&self, session_id: &str, lsn: u64)
Record that a session wrote at this LSN
Sourcepub fn get_required_lsn(&self, session_id: &str) -> Option<u64>
pub fn get_required_lsn(&self, session_id: &str) -> Option<u64>
Get the required LSN for read-your-writes
Returns None if no writes recorded or requirement expired
Sourcepub fn has_requirement(&self, session_id: &str) -> bool
pub fn has_requirement(&self, session_id: &str) -> bool
Check if a session has a pending RYW requirement
Sourcepub fn clear(&self, session_id: &str)
pub fn clear(&self, session_id: &str)
Clear LSN requirement (after successful read that satisfied it)
Sourcepub fn clear_session(&self, session_id: &str)
pub fn clear_session(&self, session_id: &str)
Clear all requirements for a session
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Get number of tracked sessions
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ReadYourWritesTracker
impl !RefUnwindSafe for ReadYourWritesTracker
impl Send for ReadYourWritesTracker
impl Sync for ReadYourWritesTracker
impl Unpin for ReadYourWritesTracker
impl UnsafeUnpin for ReadYourWritesTracker
impl UnwindSafe for ReadYourWritesTracker
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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