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
PageFree
Page deallocation - return page to free list
Fields
PageWrite
Page write - write data to page
Fields
BTreeSplit
B+Tree page split
Fields
Checkpoint
Checkpoint - persist database state
Fields
TransactionBegin
Transaction begin marker
TransactionCommit
Transaction commit marker
TransactionRollback
Transaction rollback marker
KvSet
KV Set operation
Fields
KvDelete
KV Delete operation
KvTombstone
KV Tombstone for MVCC
Fields
EdgeInsert
Edge Insert - insert edge into edge cluster
Implementations§
Source§impl V3WALRecord
impl V3WALRecord
Sourcepub fn record_type(&self) -> V3WALRecordType
pub fn record_type(&self) -> V3WALRecordType
Get the record type
Sourcepub fn is_data_modifying(&self) -> bool
pub fn is_data_modifying(&self) -> bool
Check if this record modifies page data (requires checkpoint)
Sourcepub fn is_transaction_control(&self) -> bool
pub fn is_transaction_control(&self) -> bool
Check if this is a transaction control record
Sourcepub fn is_checkpoint(&self) -> bool
pub fn is_checkpoint(&self) -> bool
Check if this is a checkpoint record
Sourcepub fn to_bytes(&self) -> NativeResult<Vec<u8>>
pub fn to_bytes(&self) -> NativeResult<Vec<u8>>
Serialize record to bytes using bincode
Sourcepub fn from_bytes(bytes: &[u8]) -> NativeResult<Self>
pub fn from_bytes(bytes: &[u8]) -> NativeResult<Self>
Deserialize record from bytes using bincode
Sourcepub fn calculate_checksum(&self) -> u64
pub fn calculate_checksum(&self) -> u64
Calculate checksum for the serialized record
Sourcepub fn page_allocate(page_id: u64, lsn: u64) -> Self
pub fn page_allocate(page_id: u64, lsn: u64) -> Self
Create a PageAllocate record
Sourcepub fn page_write(page_id: u64, offset: u32, data: Vec<u8>, lsn: u64) -> Self
pub fn page_write(page_id: u64, offset: u32, data: Vec<u8>, lsn: u64) -> Self
Create a PageWrite record
Sourcepub fn btree_split(
original_page_id: u64,
new_page_id: u64,
split_key: u64,
is_leaf: bool,
lsn: u64,
) -> Self
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
Sourcepub fn checkpoint(
root_page_id: u64,
total_pages: u64,
btree_height: u32,
free_page_list_head: u64,
header: &PersistentHeaderV3,
lsn: u64,
) -> Self
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
Trait Implementations§
Source§impl Clone for V3WALRecord
impl Clone for V3WALRecord
Source§fn clone(&self) -> V3WALRecord
fn clone(&self) -> V3WALRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for V3WALRecord
impl Debug for V3WALRecord
Source§impl<'de> Deserialize<'de> for V3WALRecord
impl<'de> Deserialize<'de> for V3WALRecord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for V3WALRecord
impl RefUnwindSafe for V3WALRecord
impl Send for V3WALRecord
impl Sync for V3WALRecord
impl Unpin for V3WALRecord
impl UnsafeUnpin for V3WALRecord
impl UnwindSafe for V3WALRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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