pub struct LogBatch { /* private fields */ }Expand description
A batch of log records yielded by the tailer stream.
Each record is a parsed JSON value. A batch may contain records from multiple segment files when a file boundary is crossed while filling the batch.
Call LogBatch::commit after processing the batch to advance
the checkpoint. If commit is not called the checkpoint remains
at its prior position, so the records in this batch will be
re-read on the next run.
Implementations§
Source§impl LogBatch
impl LogBatch
Sourcepub fn with_consumer_name(name: String) -> Self
pub fn with_consumer_name(name: String) -> Self
Create a new empty batch for the named consumer.
Sourcepub fn consumer_name(&self) -> &str
pub fn consumer_name(&self) -> &str
The name of the consumer this batch belongs to.
Sourcepub fn commit(&mut self) -> Result<()>
pub fn commit(&mut self) -> Result<()>
Advance the checkpoint to the end of this batch.
This confirms that the caller has successfully processed the batch. If checkpointing is not enabled, or if this batch has already been committed, this is a no-op.
Sourcepub fn file_names(&self) -> &[Utf8PathBuf]
pub fn file_names(&self) -> &[Utf8PathBuf]
The list of unique segment file names that contributed records to this batch.
Sourcepub fn file_name_for_line(&self, index: usize) -> &Utf8PathBuf
pub fn file_name_for_line(&self, index: usize) -> &Utf8PathBuf
Return the segment file name for the record at index.
Sourcepub fn byte_offset_for_line(&self, index: usize) -> u64
pub fn byte_offset_for_line(&self, index: usize) -> u64
Return the byte offset in the decompressed stream for the record
at index.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogBatch
impl !RefUnwindSafe for LogBatch
impl Send for LogBatch
impl !Sync for LogBatch
impl Unpin for LogBatch
impl !UnwindSafe for LogBatch
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
§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>
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