pub struct SegmentWriter { /* private fields */ }Expand description
Writer for multi-file checkpoint segments
Implementations§
Source§impl SegmentWriter
impl SegmentWriter
Sourcepub fn create(
config: MultiFileCheckpointConfig,
index: u32,
lsn_start: u64,
) -> CheckpointResult<Self>
pub fn create( config: MultiFileCheckpointConfig, index: u32, lsn_start: u64, ) -> CheckpointResult<Self>
Create a new segment writer
Sourcepub fn write_data(&mut self, data: &[u8]) -> CheckpointResult<usize>
pub fn write_data(&mut self, data: &[u8]) -> CheckpointResult<usize>
Write data to the current segment
Sourcepub fn needs_rotation(&self) -> bool
pub fn needs_rotation(&self) -> bool
Check if segment needs rotation
Sourcepub fn remaining_space(&self) -> u64
pub fn remaining_space(&self) -> u64
Get remaining space in current segment
Sourcepub fn rotate_segment(&mut self, lsn_start: u64) -> CheckpointResult<()>
pub fn rotate_segment(&mut self, lsn_start: u64) -> CheckpointResult<()>
Finalize current segment and create a new one
Sourcepub fn finalize(
&mut self,
lsn_end: u64,
block_count: u64,
) -> CheckpointResult<CheckpointSegment>
pub fn finalize( &mut self, lsn_end: u64, block_count: u64, ) -> CheckpointResult<CheckpointSegment>
Finalize the current segment
Sourcepub fn completed_segments(&self) -> &[CheckpointSegment]
pub fn completed_segments(&self) -> &[CheckpointSegment]
Get all completed segments
Sourcepub fn current_index(&self) -> u32
pub fn current_index(&self) -> u32
Get current segment index
Sourcepub fn current_size(&self) -> u64
pub fn current_size(&self) -> u64
Get current segment size
Sourcepub fn flush(&mut self) -> CheckpointResult<()>
pub fn flush(&mut self) -> CheckpointResult<()>
Flush current data without finalizing
Auto Trait Implementations§
impl Freeze for SegmentWriter
impl RefUnwindSafe for SegmentWriter
impl Send for SegmentWriter
impl Sync for SegmentWriter
impl Unpin for SegmentWriter
impl UnwindSafe for SegmentWriter
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