Skip to main content

V3WALRecord

Enum V3WALRecord 

Source
pub enum V3WALRecord {
    PageAllocate {
        lsn: u64,
        page_id: u64,
        timestamp: u64,
    },
    PageFree {
        lsn: u64,
        page_id: u64,
        checksum: u32,
        timestamp: u64,
    },
    PageWrite {
        lsn: u64,
        page_id: u64,
        offset: u32,
        data: Vec<u8>,
        checksum: u32,
        timestamp: u64,
    },
    BTreeSplit {
        lsn: u64,
        original_page_id: u64,
        new_page_id: u64,
        split_key: u64,
        page_type: u8,
        timestamp: u64,
    },
    Checkpoint {
        lsn: u64,
        root_page_id: u64,
        total_pages: u64,
        btree_height: u32,
        free_page_list_head: u64,
        header_snapshot: Vec<u8>,
        timestamp: u64,
    },
    TransactionBegin {
        tx_id: u64,
        lsn: u64,
        timestamp: u64,
    },
    TransactionCommit {
        tx_id: u64,
        lsn: u64,
        timestamp: u64,
    },
    TransactionRollback {
        tx_id: u64,
        lsn: u64,
        timestamp: u64,
    },
    KvSet {
        lsn: u64,
        key: Vec<u8>,
        value_bytes: Vec<u8>,
        value_type: u8,
        ttl_seconds: Option<u64>,
        timestamp: u64,
    },
    KvDelete {
        lsn: u64,
        key: Vec<u8>,
        timestamp: u64,
    },
    KvTombstone {
        lsn: u64,
        key: Vec<u8>,
        old_value_bytes: Option<Vec<u8>>,
        old_value_type: u8,
        timestamp: u64,
    },
    EdgeInsert {
        lsn: u64,
        src: i64,
        dst: i64,
        direction: u8,
        page_id: u64,
        timestamp: u64,
    },
}
Expand description

V3 WAL record for page-level operations

Each record represents a single operation that modifies the database state. Records are written sequentially to the WAL file and can be replayed during recovery to restore database state.

Variants§

§

PageAllocate

Page allocation - assign new page from PageAllocator

Fields

§lsn: u64

Log sequence number

§page_id: u64

Newly allocated page ID

§timestamp: u64

Timestamp of allocation

§

PageFree

Page deallocation - return page to free list

Fields

§lsn: u64

Log sequence number

§page_id: u64

Page ID being freed

§checksum: u32

Checksum of page before free (for validation)

§timestamp: u64

Timestamp of deallocation

§

PageWrite

Page write - write data to page

Fields

§lsn: u64

Log sequence number

§page_id: u64

Target page ID

§offset: u32

Offset within page (0-4095)

§data: Vec<u8>

Data being written

§checksum: u32

Checksum of data

§timestamp: u64

Timestamp of write

§

BTreeSplit

B+Tree page split

Fields

§lsn: u64

Log sequence number

§original_page_id: u64

Original page ID being split

§new_page_id: u64

New page ID created from split

§split_key: u64

Split key (first key in new page)

§page_type: u8

Page type being split (internal or leaf)

§timestamp: u64

Timestamp of split

§

Checkpoint

Checkpoint - persist database state

Fields

§lsn: u64

Log sequence number

§root_page_id: u64

Root B+Tree page ID

§total_pages: u64

Total pages in database

§btree_height: u32

B+Tree height

§free_page_list_head: u64

Free page list head

§header_snapshot: Vec<u8>

Full header snapshot for recovery

§timestamp: u64

Timestamp of checkpoint

§

TransactionBegin

Transaction begin marker

Fields

§tx_id: u64

Transaction ID

§lsn: u64

Log sequence number

§timestamp: u64

Timestamp

§

TransactionCommit

Transaction commit marker

Fields

§tx_id: u64

Transaction ID

§lsn: u64

Log sequence number

§timestamp: u64

Timestamp

§

TransactionRollback

Transaction rollback marker

Fields

§tx_id: u64

Transaction ID

§lsn: u64

Log sequence number

§timestamp: u64

Timestamp

§

KvSet

KV Set operation

Fields

§lsn: u64

Log sequence number

§key: Vec<u8>

Key bytes

§value_bytes: Vec<u8>

Value bytes (serialized)

§value_type: u8

Value type tag

§ttl_seconds: Option<u64>

Optional TTL in seconds

§timestamp: u64

Timestamp

§

KvDelete

KV Delete operation

Fields

§lsn: u64

Log sequence number

§key: Vec<u8>

Key bytes

§timestamp: u64

Timestamp

§

KvTombstone

KV Tombstone for MVCC

Fields

§lsn: u64

Log sequence number

§key: Vec<u8>

Key bytes

§old_value_bytes: Option<Vec<u8>>

Previous value (for rollback)

§old_value_type: u8

Previous value type

§timestamp: u64

Timestamp

§

EdgeInsert

Edge Insert - insert edge into edge cluster

Fields

§lsn: u64

Log sequence number

§src: i64

Source node ID

§dst: i64

Destination node ID

§direction: u8

Edge direction (0 = Outgoing, 1 = Incoming)

§page_id: u64

Page ID where edge cluster will be stored

§timestamp: u64

Timestamp

Implementations§

Source§

impl V3WALRecord

Source

pub fn record_type(&self) -> V3WALRecordType

Get the record type

Source

pub fn lsn(&self) -> u64

Get the LSN for this record

Source

pub fn is_data_modifying(&self) -> bool

Check if this record modifies page data (requires checkpoint)

Source

pub fn is_transaction_control(&self) -> bool

Check if this is a transaction control record

Source

pub fn is_checkpoint(&self) -> bool

Check if this is a checkpoint record

Source

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

Serialize record to bytes using bincode

Source

pub fn from_bytes(bytes: &[u8]) -> NativeResult<Self>

Deserialize record from bytes using bincode

Source

pub fn calculate_checksum(&self) -> u64

Calculate checksum for the serialized record

Source

pub fn page_allocate(page_id: u64, lsn: u64) -> Self

Create a PageAllocate record

Source

pub fn page_free(page_id: u64, checksum: u32, lsn: u64) -> Self

Create a PageFree record

Source

pub fn page_write(page_id: u64, offset: u32, data: Vec<u8>, lsn: u64) -> Self

Create a PageWrite record

Source

pub fn btree_split( original_page_id: u64, new_page_id: u64, split_key: u64, is_leaf: bool, lsn: u64, ) -> Self

Create a BTreeSplit record

Source

pub fn checkpoint( root_page_id: u64, total_pages: u64, btree_height: u32, free_page_list_head: u64, header: &PersistentHeaderV3, lsn: u64, ) -> Self

Create a Checkpoint record

Source

pub fn edge_insert( src: i64, dst: i64, direction: u8, page_id: u64, lsn: u64, ) -> Self

Create an EdgeInsert record

Trait Implementations§

Source§

impl Clone for V3WALRecord

Source§

fn clone(&self) -> V3WALRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for V3WALRecord

Source§

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

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

impl<'de> Deserialize<'de> for V3WALRecord

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 V3WALRecord

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V