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
impl RecordContext
sourcepub fn claim_local_version(&mut self) -> FdbResult<u16>
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.
sourcepub fn get_transaction_age(&self) -> FdbResult<u64>
pub fn get_transaction_age(&self) -> FdbResult<u64>
Get the number of milliseconds since context was created.
sourcepub fn set_incarnation_version(
&mut self,
incarnation_version: u64
) -> FdbResult<()>
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.
sourcepub fn get_incarnation_version(&self) -> Option<u64>
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.