pub struct OooBuffer<L, E>where
L: LogId,
E: Extensions,{ /* private fields */ }ingest only.Expand description
Out-of-order (ooo) buffer allowing a configurable window for handling operations with no predecessors yet.
For every operation this buffer checks if it arrived out-of-order. If yes, it is stored in the internal ring-buffer. If the buffer runs full the oldest item gets evicted first.
§Example
If a log is at log height [1] (frontier) and an operation of sequence number [3] arrives, it
can not be appended to the log due to the strict nature of an append-only log. It will be pushed
into the buffer, awaiting the missing [2] operation:
[0] <- [1] <- Log in database
[3] <- Incoming operation
=> Push into ooo-Buffer.Operation [2] arrives which will “free” the out-of-order items in the buffer, making them “in
order”. It will release them from the buffer and forward to the user for further validation and
finally insertion into the database:
[0] <- [1] <- Log in database
[3] <- Operation in ooo-Buffer
[2] <- Incoming operation
=> Return [2, 3]§Assumptions
Please make sure to only process items which have been checked before against:
- Incoming operations from tombstoned logs / topics were filtered out before.
- Duplicate, already ingested operations have been filtered out before.
Implementations§
Source§impl<L, E> OooBuffer<L, E>where
L: LogId,
E: Extensions,
impl<L, E> OooBuffer<L, E>where
L: LogId,
E: Extensions,
pub fn new() -> OooBuffer<L, E>
pub fn with_capacity(capacity: usize) -> OooBuffer<L, E>
pub async fn len(&self) -> usize
pub async fn is_empty(&self) -> bool
pub async fn clear(&self)
pub async fn process<'a>( &self, operation: &'a Operation<E>, latest_header: Option<&AnyHeader>, log_id: &L, prune_flag: bool, ) -> OooResult<'a, E>
Trait Implementations§
Auto Trait Implementations§
impl<L, E> !RefUnwindSafe for OooBuffer<L, E>
impl<L, E> !UnwindSafe for OooBuffer<L, E>
impl<L, E> Forget for OooBuffer<L, E>
impl<L, E> Freeze for OooBuffer<L, E>
impl<L, E> Send for OooBuffer<L, E>
impl<L, E> Sync for OooBuffer<L, E>
impl<L, E> Unpin for OooBuffer<L, E>
impl<L, E> UnsafeUnpin for OooBuffer<L, E>
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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