pub struct ParallelWriters { /* private fields */ }Expand description
Parallel, pipelined writer pool.
The producer (parser thread) stages per-table bytes and ships ~256KB chunks
over bounded channels to N writer threads, each owning a disjoint shard of
tables (sharded by name hash). This overlaps parsing with writing (a
pipeline / double-buffer) and keeps several writes in flight so a single
synchronous thread doesn’t bottleneck a fast SSD (queue depth > 1). Batching
into large chunks keeps per-statement channel overhead negligible.
Output is byte-identical to the single-threaded WriterPool: each table’s
file is written by exactly one thread, in input order.
Implementations§
Source§impl ParallelWriters
impl ParallelWriters
Sourcepub fn new(
output_dir: PathBuf,
num_writers: usize,
capacity: usize,
format: Compression,
) -> Result<Self>
pub fn new( output_dir: PathBuf, num_writers: usize, capacity: usize, format: Compression, ) -> Result<Self>
Spawn num_writers writer threads targeting output_dir, compressing
each per-table file with format. capacity is the per-shard channel
depth (chunks in flight).
Sourcepub fn errored(&self) -> bool
pub fn errored(&self) -> bool
True once any writer thread has hit an I/O error, so the producer can
stop early; the actual error surfaces from finish.
Auto Trait Implementations§
impl !RefUnwindSafe for ParallelWriters
impl !UnwindSafe for ParallelWriters
impl Freeze for ParallelWriters
impl Send for ParallelWriters
impl Sync for ParallelWriters
impl Unpin for ParallelWriters
impl UnsafeUnpin for ParallelWriters
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> 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