pub struct DeltaAllocator { /* private fields */ }Expand description
Packs raw chunk bytes into compressed blocks.
The current (unflushed) block is held in memory; completed blocks are
compressed and written to a single backing tempfile. fetch
serves the current block from memory and decompresses completed blocks
from that file on demand — no second file is needed.
Call commit to flush the final block and
retrieve the compressed output file plus block metadata.
Implementations§
Source§impl DeltaAllocator
impl DeltaAllocator
pub fn new(codec: Arc<dyn CompressionCodec>, block_target_size: usize) -> Self
Sourcepub fn allocate(&mut self, slice: &[u8]) -> BlockAllocAddress
pub fn allocate(&mut self, slice: &[u8]) -> BlockAllocAddress
Appends slice to the current block and returns its allocation address.
Flushes the current block to the output file if it reaches the target size.
Sourcepub fn fetch(&self, addr: &BlockAllocAddress) -> Option<Bytes>
pub fn fetch(&self, addr: &BlockAllocAddress) -> Option<Bytes>
Returns the raw (uncompressed) bytes for the given allocation address.
Serves the current block from memory; for completed blocks it reads from the tempfile at the block’s offset (positional read, no seek), decompresses the block, and slices out the bytes.
Sourcepub async fn commit(self) -> AllocatorOutput
pub async fn commit(self) -> AllocatorOutput
Flushes the remaining partial block and returns a file handle to the compressed output (seeked to position 0), the total output size, and the block metadata table.
Auto Trait Implementations§
impl Freeze for DeltaAllocator
impl !RefUnwindSafe for DeltaAllocator
impl Send for DeltaAllocator
impl Sync for DeltaAllocator
impl Unpin for DeltaAllocator
impl UnsafeUnpin for DeltaAllocator
impl !UnwindSafe for DeltaAllocator
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<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.