Skip to main content

should_emit_event

Function should_emit_event 

Source
pub fn should_emit_event(record: &V2WALRecord) -> bool
Expand description

Check if a WAL record type should emit an event

Returns true if the record type corresponds to a data modification that should trigger a pub/sub event.

ยงExamples

use sqlitegraph::backend::native::v2::wal::V2WALRecord;
use sqlitegraph::backend::native::v2::pubsub::emit::should_emit_event;

let record = V2WALRecord::NodeInsert {
    node_id: 1,
    slot_offset: 0,
    node_data: vec![1, 2, 3],
};
assert!(should_emit_event(&record));

let record = V2WALRecord::TransactionBegin {
    tx_id: 1,
    timestamp: 0,
};
assert!(!should_emit_event(&record));