pub struct InputQueue<A = (), B = Box<dyn InputBuffer>> {
pub queue: Mutex<VecDeque<InputQueueEntry<A, B>>>,
pub consumer: Box<dyn InputConsumer>,
pub transaction_in_progress: AtomicBool,
}Expand description
A thread-safe queue for collecting and flushing input buffers.
Commonly used by InputReader implementations for staging buffers from
worker threads.
Fields§
§queue: Mutex<VecDeque<InputQueueEntry<A, B>>>§consumer: Box<dyn InputConsumer>§transaction_in_progress: AtomicBoolImplementations§
Source§impl<A, B: InputBuffer> InputQueue<A, B>
impl<A, B: InputBuffer> InputQueue<A, B>
pub fn new(consumer: Box<dyn InputConsumer>) -> Self
pub fn push_entry(&self, entry: InputQueueEntry<A, B>, errors: Vec<ParseError>)
Sourcepub fn push_with_aux(
&self,
(buffer, errors): (Option<B>, Vec<ParseError>),
timestamp: DateTime<Utc>,
aux: A,
)
pub fn push_with_aux( &self, (buffer, errors): (Option<B>, Vec<ParseError>), timestamp: DateTime<Utc>, aux: A, )
Appends buffer, to the queue, and associates it with aux. Reports
to the controller that errors have occurred during parsing.
Sourcepub fn flush_with_aux(
&self,
) -> (BufferSize, Option<Xxh3Default>, Vec<(DateTime<Utc>, A)>)
pub fn flush_with_aux( &self, ) -> (BufferSize, Option<Xxh3Default>, Vec<(DateTime<Utc>, A)>)
Flushes a batch of records to the circuit and returns the auxiliary data that was associated with those records.
This always flushes whole buffers to the circuit (with flush),
since auxiliary data is associated with a whole buffer rather than with
individual records. If the auxiliary data type A is (), then
[InputQueue<()>::flush] avoids that and so is a better choice.
Sourcepub fn flush_with_aux_until(
&self,
stop_at: &dyn Fn(&A) -> bool,
) -> (BufferSize, Option<Xxh3Default>, Vec<(DateTime<Utc>, A)>)
pub fn flush_with_aux_until( &self, stop_at: &dyn Fn(&A) -> bool, ) -> (BufferSize, Option<Xxh3Default>, Vec<(DateTime<Utc>, A)>)
Flushes a batch of records to the circuit and returns the auxiliary data that was associated with those records.
Stops after flushing at least max_batch_size records or after flushing a
buffer whose auxiliary data satisfies the stop_at predicate, whichever
happens first.
This always flushes whole buffers to the circuit (with flush),
since auxiliary data is associated with a whole buffer rather than with
individual records. If the auxiliary data type A is (), then
[InputQueue<()>::flush] avoids that and so is a better choice.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Source§impl InputQueue<(), Box<dyn InputBuffer>>
impl InputQueue<(), Box<dyn InputBuffer>>
Sourcepub fn push(
&self,
(buffer, errors): (Option<Box<dyn InputBuffer>>, Vec<ParseError>),
timestamp: DateTime<Utc>,
)
pub fn push( &self, (buffer, errors): (Option<Box<dyn InputBuffer>>, Vec<ParseError>), timestamp: DateTime<Utc>, )
Appends buffer, if nonempty,to the queue. Reports to the controller thaterrors` occurred during parsing.
Auto Trait Implementations§
impl<A = (), B = Box<dyn InputBuffer>> !Freeze for InputQueue<A, B>
impl<A = (), B = Box<dyn InputBuffer>> !RefUnwindSafe for InputQueue<A, B>
impl<A = (), B = Box<dyn InputBuffer>> !UnwindSafe for InputQueue<A, B>
impl<A, B> Send for InputQueue<A, B>
impl<A, B> Sync for InputQueue<A, B>
impl<A, B> Unpin for InputQueue<A, B>
impl<A, B> UnsafeUnpin for InputQueue<A, B>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<T> ErasedDestructor for Twhere
T: 'static,
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