Struct fdb_rl::RecordContext

source ·
pub struct RecordContext {
    instant: Instant,
    incarnation_version: Option<u64>,
    local_version: u16,
}
Expand description

Provides context information for use by other types in the Record Layer.

RecordContext is a singleton within a FDB transaction. There must be only one value of RecordContext in a FDB transaction.

Fields§

§instant: Instant

Instant when this RecordContext was created.

§incarnation_version: Option<u64>

Used by RecordVersion.

§local_version: u16

Used by RecordVersion.

Implementations§

source§

impl RecordContext

source

pub fn claim_local_version(&mut self) -> FdbResult<u16>

Claims a local version that is unique within a single transaction.

This means that any two calls to this method will return a different value. If the ordering of the calls is deterministic, then it is also guaranteed that the earlier calls will receive a smaller version than the newer calls.

source

pub fn get_transaction_age(&self) -> FdbResult<u64>

Get the number of milliseconds since context was created.

source

pub fn set_incarnation_version( &mut self, incarnation_version: u64 ) -> FdbResult<()>

Set the incarnation version that can be used by other methods within a Record Layer transaction.

Attempting to set this value twice, will result in an error.

source

pub fn get_incarnation_version(&self) -> Option<u64>

Get the incarnation version that can be used by other methods within a Record Layer transaction.

Returns None, if no incarnation version was previously set.

Trait Implementations§

source§

impl Debug for RecordContext

source§

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

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

impl Default for RecordContext

source§

fn default() -> RecordContext

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

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.