Skip to main content

MvccClock

Struct MvccClock 

Source
pub struct MvccClock { /* private fields */ }
Expand description

Process-wide logical clock. Cheap to clone — internally an Arc over an AtomicU64 in the Database wiring (added in Phase 11.3). Standalone today.

Implementations§

Source§

impl MvccClock

Source

pub fn new(initial: u64) -> Self

Builds a clock seeded at initial. The next MvccClock::tick returns initial + 1.

Use this with the value persisted in the WAL header at open time so the clock resumes past the last-checkpointed high-water mark.

Source

pub fn now(&self) -> u64

Returns the current high-water timestamp without advancing it. Phase 11.6’s GC reads this alongside super::ActiveTxRegistry::min_active_begin_ts to decide which row-version chains are reclaimable.

Source

pub fn tick(&self) -> u64

Bumps the clock by one and returns the new value. Strictly monotonic: every call observes a distinct u64.

Source

pub fn observe(&self, value: u64)

Promotes the clock to at least value. No-op if value is at or below the current high-water mark. Used at WAL replay to bring the in-memory clock up to the persisted high-water without an extra tick().

Trait Implementations§

Source§

impl Debug for MvccClock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MvccClock

Source§

fn default() -> MvccClock

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.