pub struct ChangelogRecord {
pub operation: CdcOperation,
pub weight: i32,
pub emit_timestamp: i64,
pub event: Event,
}Expand description
A changelog record with Z-set weight for CDC pipelines.
This wraps an event with metadata needed for change data capture:
- Operation type (insert/delete/update)
- Z-set weight (+1/-1)
- Timestamp of the change
Used by EmitStrategy::Changelog to emit structured change records
that can be consumed by downstream systems expecting CDC format.
§Example
use laminar_core::operator::window::{ChangelogRecord, CdcOperation};
use laminar_core::operator::Event;
// Create an insert record
let record = ChangelogRecord::insert(event, 1000);
assert_eq!(record.operation, CdcOperation::Insert);
assert_eq!(record.weight, 1);
// Create a retraction pair for an update
let (before, after) = ChangelogRecord::update(old_event, new_event, 1000);
assert_eq!(before.weight, -1); // Retract old
assert_eq!(after.weight, 1); // Insert newFields§
§operation: CdcOperationThe CDC operation type
weight: i32Z-set weight (+1 for insert, -1 for delete)
emit_timestamp: i64Timestamp when this change was emitted
event: EventThe event data
Implementations§
Source§impl ChangelogRecord
impl ChangelogRecord
Sourcepub fn update(
old_event: Event,
new_event: Event,
emit_timestamp: i64,
) -> (Self, Self)
pub fn update( old_event: Event, new_event: Event, emit_timestamp: i64, ) -> (Self, Self)
Creates an update retraction pair (before and after records).
Returns a tuple of (UpdateBefore, UpdateAfter) records.
The first should be emitted before the second to properly
retract the old value.
Sourcepub fn new(operation: CdcOperation, event: Event, emit_timestamp: i64) -> Self
pub fn new(operation: CdcOperation, event: Event, emit_timestamp: i64) -> Self
Creates a changelog record from raw parts.
Trait Implementations§
Source§impl Clone for ChangelogRecord
impl Clone for ChangelogRecord
Source§fn clone(&self) -> ChangelogRecord
fn clone(&self) -> ChangelogRecord
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ChangelogRecord
impl !RefUnwindSafe for ChangelogRecord
impl Send for ChangelogRecord
impl Sync for ChangelogRecord
impl Unpin for ChangelogRecord
impl UnsafeUnpin for ChangelogRecord
impl !UnwindSafe for ChangelogRecord
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.