pub struct Writer<T> { /* private fields */ }Implementations§
Source§impl<T: SegmentReadWrite> Writer<T>
impl<T: SegmentReadWrite> Writer<T>
Sourcepub fn new_at(
ctx: T,
buf_size: usize,
segid: SegmentId,
hyper_file_config: &HyperFileMetaConfig,
) -> Self
pub fn new_at( ctx: T, buf_size: usize, segid: SegmentId, hyper_file_config: &HyperFileMetaConfig, ) -> Self
A writer aimed at exactly the object segid names.
Sourcepub fn set_base(&mut self, fingerprint: u64)
pub fn set_base(&mut self, fingerprint: u64)
Record the inode this checkpoint is built on; see SegmentHeader::s_base.
Sourcepub fn mark_partial(&mut self)
pub fn mark_partial(&mut self)
Mark what this writer produces as one piece of an unfinished checkpoint.
Sourcepub fn mark_cleaner(&mut self)
pub fn mark_cleaner(&mut self)
Mark what this writer produces as a compactor’s.
pub fn new( ctx: T, buf_size: usize, segid: SegmentId, hyper_file_config: &HyperFileMetaConfig, ) -> Self
Sourcepub fn blocks_that_fit(cap: usize, fixed: usize, block_size: usize) -> usize
pub fn blocks_that_fit(cap: usize, fixed: usize, block_size: usize) -> usize
How many data blocks of block_size one object of at most cap bytes can
hold after fixed bytes of meta blocks, counting the summary those blocks
need. Zero when not even the summary and the meta blocks fit.
pub fn calc_ss_aligned_bytes(ndatablk: usize) -> usize
pub fn realize_ss(&mut self, checksum: u32, inode: &InodeRaw)
pub fn append(&mut self, buf: &[u8]) -> Result<()>
Sourcepub fn append_data_block(&mut self, block: &DataBlock) -> Result<()>
pub fn append_data_block(&mut self, block: &DataBlock) -> Result<()>
Append one cached data block to the segment.
Non-WAL: pushes a zero-copy Bytes view over the block’s
internal Arc<AllocDataBlock> (no memcpy of the 4 KiB
payload). The cache continues to hold the block; the
segment body holds an extra Arc clone via the Bytes,
so the buffer lives as long as the upload needs it.
WAL: falls back to the buffer-based append path because
the WAL feature requires the segment body to live as one
contiguous Vec<u8> for in-memory replay.
Sourcepub fn append_lazy(&mut self, src: Arc<dyn BlockSource>, off: u64, len: usize)
pub fn append_lazy(&mut self, src: Arc<dyn BlockSource>, off: u64, len: usize)
Append len bytes to be read from src at off when the part holding them
is uploaded (see crate::block_source). Non-WAL only: the WAL path keeps
the whole segment in one buffer, which is the memory a reference avoids.
pub async fn done(self) -> Result<()>
Source§impl<T> Writer<T>
impl<T> Writer<T>
pub fn inc_metablk(&mut self)
pub fn inc_datablk(&mut self, blkidx: &BlockIndex, blkptr: &BlockPtr)
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Writer<T>
impl<T> !UnwindSafe for Writer<T>
impl<T> Freeze for Writer<T>where
T: Freeze,
impl<T> Send for Writer<T>where
T: Send,
impl<T> Sync for Writer<T>where
T: Sync,
impl<T> Unpin for Writer<T>where
T: Unpin,
impl<T> UnsafeUnpin for Writer<T>where
T: UnsafeUnpin,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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