pub struct TransactionIdManager { /* private fields */ }Expand description
Transaction ID manager with wraparound protection
Uses PostgreSQL’s pattern: stop accepting writes at 1M transactions before u64::MAX to prevent wraparound issues.
Implementations§
Source§impl TransactionIdManager
impl TransactionIdManager
Sourcepub const SAFETY_MARGIN: u64 = 1_000_000
pub const SAFETY_MARGIN: u64 = 1_000_000
Safety margin from u64::MAX (PostgreSQL pattern: 1M transactions)
Sourcepub const WRAP_WARNING_THRESHOLD: u64
pub const WRAP_WARNING_THRESHOLD: u64
Warning threshold (10M transactions before hard limit)
pub fn new() -> Self
Sourcepub fn allocate(&self) -> NativeResult<TransactionId>
pub fn allocate(&self) -> NativeResult<TransactionId>
Allocate next transaction ID with wraparound protection
Sourcepub fn needs_wraparound_protection(&self) -> bool
pub fn needs_wraparound_protection(&self) -> bool
Check if transaction ID cleanup is needed
Sourcepub fn current_id(&self) -> u64
pub fn current_id(&self) -> u64
Get current transaction ID (for monitoring)
Sourcepub fn remaining_ids(&self) -> u64
pub fn remaining_ids(&self) -> u64
Get remaining transaction IDs before hard limit
Auto Trait Implementations§
impl Freeze for TransactionIdManager
impl !RefUnwindSafe for TransactionIdManager
impl Send for TransactionIdManager
impl Sync for TransactionIdManager
impl Unpin for TransactionIdManager
impl !UnwindSafe for TransactionIdManager
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> 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