pub struct ShardWriter { /* private fields */ }Expand description
Builder for creating shards.
A shard is a zstd-compressed blob of concatenated file contents. File indexing is handled by the TreeManifest, not the shard itself. Shards are opaque blocks — like filesystem blocks.
Implementations§
Source§impl ShardWriter
impl ShardWriter
Sourcepub fn finish(self, compression_level: i32) -> Result<Vec<u8>>
pub fn finish(self, compression_level: i32) -> Result<Vec<u8>>
Finishes building and returns the zstd-compressed shard bytes.
§Errors
Returns VoidError::Compression if compression fails.
Sourcepub fn file_count(&self) -> u32
pub fn file_count(&self) -> u32
Returns the number of files added.
Sourcepub fn finish_padded(
self,
strategy: PaddingStrategy,
compression_level: i32,
) -> Result<Vec<u8>>
pub fn finish_padded( self, strategy: PaddingStrategy, compression_level: i32, ) -> Result<Vec<u8>>
Finishes building and returns serialized shard bytes with optional size padding.
Padding is applied to hide the true shard size from the server. The padding size is stored as a little-endian u64 at the end of the shard.
§Errors
Returns VoidError::Compression if compression fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShardWriter
impl RefUnwindSafe for ShardWriter
impl Send for ShardWriter
impl Sync for ShardWriter
impl Unpin for ShardWriter
impl UnsafeUnpin for ShardWriter
impl UnwindSafe for ShardWriter
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
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