pub struct ChangelogBuffer { /* private fields */ }Expand description
Ring 0 changelog buffer (pre-allocated, reused per epoch).
This buffer stores changelog references without allocating on the hot path (after initial warmup). When the buffer is full, it signals backpressure.
§Example
use laminar_core::operator::changelog::{ChangelogBuffer, ChangelogRef};
let mut buffer = ChangelogBuffer::with_capacity(1024);
// Push references (no allocation after warmup)
for i in 0..100 {
buffer.push(ChangelogRef::insert(i, 0));
}
// Drain for Ring 1 processing
for changelog_ref in buffer.drain() {
// Process in Ring 1
}Implementations§
Source§impl ChangelogBuffer
impl ChangelogBuffer
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new buffer with the given capacity.
Sourcepub fn push(&mut self, changelog_ref: ChangelogRef) -> bool
pub fn push(&mut self, changelog_ref: ChangelogRef) -> bool
Pushes a changelog reference (no allocation if under capacity).
Returns true if the reference was added, false if buffer is full
(backpressure signal).
Sourcepub fn push_retraction(
&mut self,
batch_offset: u32,
old_row_index: u32,
new_row_index: u32,
) -> bool
pub fn push_retraction( &mut self, batch_offset: u32, old_row_index: u32, new_row_index: u32, ) -> bool
Pushes a retraction pair (update-before, update-after).
Returns true if both references were added, false if buffer is full.
Sourcepub fn drain(&mut self) -> impl Iterator<Item = ChangelogRef> + '_
pub fn drain(&mut self) -> impl Iterator<Item = ChangelogRef> + '_
Drains references for Ring 1 processing.
After draining, the buffer is empty but retains its capacity.
Sourcepub fn as_slice(&self) -> &[ChangelogRef]
pub fn as_slice(&self) -> &[ChangelogRef]
Returns a slice of the current references.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChangelogBuffer
impl RefUnwindSafe for ChangelogBuffer
impl Send for ChangelogBuffer
impl Sync for ChangelogBuffer
impl Unpin for ChangelogBuffer
impl UnsafeUnpin for ChangelogBuffer
impl UnwindSafe for ChangelogBuffer
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
§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.