TxnWalEntry

Struct TxnWalEntry 

Source
pub struct TxnWalEntry {
    pub record_type: WalRecordType,
    pub txn_id: TxnId,
    pub timestamp_us: u64,
    pub key: Option<Vec<u8>>,
    pub value: Option<Vec<u8>>,
    pub table: Option<String>,
    pub checksum: u32,
    pub lsn: Lsn,
    pub prev_lsn: Option<Lsn>,
    pub page_id: Option<PageId>,
    pub undo_info: Option<Vec<u8>>,
    pub undo_next_lsn: Option<Lsn>,
}
Expand description

WAL entry with ARIES transaction support

Extends standard WAL entries with ARIES-specific fields:

  • LSN: Log Sequence Number for ordering and idempotent recovery
  • prev_lsn: Previous LSN for this transaction (undo chain)
  • undo_info: Before-image for undo operations
  • page_id: Page affected by this operation

Fields§

§record_type: WalRecordType

Type of this WAL record

§txn_id: TxnId

Transaction ID

§timestamp_us: u64

Timestamp in microseconds

§key: Option<Vec<u8>>

Optional key for data records

§value: Option<Vec<u8>>

Optional value for data records (after-image)

§table: Option<String>

Optional table name

§checksum: u32

CRC32 checksum

§lsn: Lsn

ARIES: Log Sequence Number (assigned when appended to WAL)

§prev_lsn: Option<Lsn>

ARIES: Previous LSN in this transaction’s chain (for undo)

§page_id: Option<PageId>

ARIES: Page ID affected by this record

§undo_info: Option<Vec<u8>>

ARIES: Before-image for undo (original value before update)

§undo_next_lsn: Option<Lsn>

ARIES: For CLRs, the next LSN to undo (skips compensated operations)

Implementations§

Source§

impl TxnWalEntry

Source

pub fn new_begin(txn_id: TxnId, timestamp_us: u64) -> Self

Source

pub fn new_commit(txn_id: TxnId, timestamp_us: u64) -> Self

Source

pub fn new_abort(txn_id: TxnId, timestamp_us: u64) -> Self

Source

pub fn new_data( txn_id: TxnId, timestamp_us: u64, table: String, key: Vec<u8>, value: Option<Vec<u8>>, ) -> Self

Source

pub fn new_aries_data( txn_id: TxnId, timestamp_us: u64, table: String, key: Vec<u8>, value: Option<Vec<u8>>, page_id: PageId, prev_lsn: Option<Lsn>, undo_info: Option<Vec<u8>>, ) -> Self

Create a new ARIES-style data record with before-image for undo

Source

pub fn new_clr( txn_id: TxnId, timestamp_us: u64, table: String, key: Vec<u8>, value: Option<Vec<u8>>, page_id: PageId, prev_lsn: Lsn, undo_next_lsn: Lsn, ) -> Self

Create a Compensation Log Record (CLR) for ARIES undo

CLRs are redo-only records that describe undo operations. They include undo_next_lsn which points to the next record to undo, skipping the compensated operation.

Source

pub fn new_checkpoint_end( timestamp_us: u64, checkpoint_data: AriesCheckpointData, ) -> Result<Self, String>

Create a checkpoint end record with recovery data

Source

pub fn get_checkpoint_data(&self) -> Option<AriesCheckpointData>

Extract checkpoint data from a CheckpointEnd record

Source

pub fn compute_checksum(&mut self)

Calculate and set checksum

Source

pub fn verify_checksum(&self) -> bool

Verify checksum

Source

pub fn to_bytes(&self) -> Vec<u8>

Serialize to bytes

Source

pub fn from_bytes(data: &[u8]) -> Result<Self, String>

Deserialize from bytes with proper error propagation

Returns an error if:

  • Data is too short (minimum 21 bytes)
  • Record type is invalid
  • Data is truncated mid-field
  • UTF-8 encoding is invalid for table name
  • Checksum validation fails

Trait Implementations§

Source§

impl Clone for TxnWalEntry

Source§

fn clone(&self) -> TxnWalEntry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TxnWalEntry

Source§

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

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

impl<'de> Deserialize<'de> for TxnWalEntry

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for TxnWalEntry

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,