pub struct RollingFileWriter<B: FileWriterBuilder, L: LocationGenerator, F: FileNameGenerator> { /* private fields */ }Expand description
A writer that automatically rolls over to a new file when the data size exceeds a target threshold.
This writer wraps another file writer that tracks the amount of data written. When the data size exceeds the target size, it closes the current file and starts writing to a new one.
Implementations§
Source§impl<B, L, F> RollingFileWriter<B, L, F>
impl<B, L, F> RollingFileWriter<B, L, F>
Sourcepub async fn write(
&mut self,
partition_key: &Option<PartitionKey>,
input: &RecordBatch,
) -> Result<()>
pub async fn write( &mut self, partition_key: &Option<PartitionKey>, input: &RecordBatch, ) -> Result<()>
Writes a record batch to the current file, rolling over to a new file if necessary.
§Parameters
partition_key- Optional partition key for the datainput- The record batch to write
§Returns
A Result indicating success or failure
§Errors
Returns an error if the writer is not initialized or if writing fails
Trait Implementations§
Source§impl<B: FileWriterBuilder, L: LocationGenerator, F: FileNameGenerator> CurrentFileStatus for RollingFileWriter<B, L, F>
impl<B: FileWriterBuilder, L: LocationGenerator, F: FileNameGenerator> CurrentFileStatus for RollingFileWriter<B, L, F>
Source§fn current_file_path(&self) -> String
fn current_file_path(&self) -> String
Get the current file path.
Source§fn current_row_num(&self) -> usize
fn current_row_num(&self) -> usize
Get the current file row number.
Source§fn current_written_size(&self) -> usize
fn current_written_size(&self) -> usize
Get the current file written size.
Source§impl<B, L, F> Debug for RollingFileWriter<B, L, F>
impl<B, L, F> Debug for RollingFileWriter<B, L, F>
Auto Trait Implementations§
impl<B, L, F> Freeze for RollingFileWriter<B, L, F>
impl<B, L, F> !RefUnwindSafe for RollingFileWriter<B, L, F>
impl<B, L, F> Send for RollingFileWriter<B, L, F>
impl<B, L, F> Sync for RollingFileWriter<B, L, F>
impl<B, L, F> Unpin for RollingFileWriter<B, L, F>
impl<B, L, F> !UnwindSafe for RollingFileWriter<B, L, F>
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any.§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