add CDC types

This commit is contained in:
Nikita Sivukhin
2025-07-28 17:38:02 +04:00
parent b27bc05c7d
commit 841bbe3f77

View File

@@ -176,6 +176,12 @@ impl From<String> for Text {
}
}
impl From<Text> for String {
fn from(value: Text) -> Self {
String::from_utf8(value.value).unwrap()
}
}
impl Display for TextRef {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.as_str())
@@ -956,6 +962,12 @@ impl ImmutableRecord {
}
}
pub fn from_bin_record(payload: Vec<u8>) -> Self {
Self {
payload: Value::Blob(payload),
}
}
// TODO: inline the complete record parsing code here.
// Its probably more efficient.
pub fn get_values(&self) -> Vec<RefValue> {
@@ -2436,6 +2448,22 @@ impl RawSlice {
}
}
#[derive(Debug)]
pub enum DatabaseChangeType {
Delete,
Update { bin_record: Vec<u8> },
Insert { bin_record: Vec<u8> },
}
#[derive(Debug)]
pub struct DatabaseChange {
pub change_id: i64,
pub change_time: u64,
pub change: DatabaseChangeType,
pub table_name: String,
pub id: i64,
}
#[derive(Debug)]
pub struct WalInsertInfo {
pub page_no: usize,