pub struct SegmentManager { /* private fields */ }Expand description
Manages WAL segment files
Implementations§
Source§impl SegmentManager
impl SegmentManager
Sourcepub fn list_segments(&self) -> Result<Vec<SegmentInfo>>
pub fn list_segments(&self) -> Result<Vec<SegmentInfo>>
List all segment files in order
Sourcepub fn total_size(&self) -> Result<u64>
pub fn total_size(&self) -> Result<u64>
Get the total size of all segments
Sourcepub fn segment_count(&self) -> Result<usize>
pub fn segment_count(&self) -> Result<usize>
Get the number of segment files
Sourcepub fn cleanup_before(&self, sequence: u64) -> Result<usize>
pub fn cleanup_before(&self, sequence: u64) -> Result<usize>
Delete segments older than the given sequence number
This is useful after a checkpoint to reclaim disk space. Returns the number of segments deleted.
Sourcepub fn cleanup_all(&self) -> Result<usize>
pub fn cleanup_all(&self) -> Result<usize>
Delete all segment files
Use with caution - this removes all WAL data!
Sourcepub fn latest_segment(&self) -> Result<Option<SegmentInfo>>
pub fn latest_segment(&self) -> Result<Option<SegmentInfo>>
Get the latest (highest sequence) segment
Sourcepub fn oldest_segment(&self) -> Result<Option<SegmentInfo>>
pub fn oldest_segment(&self) -> Result<Option<SegmentInfo>>
Get the oldest (lowest sequence) segment
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Check if the WAL directory exists and is accessible
Sourcepub fn ensure_dir(&self) -> Result<()>
pub fn ensure_dir(&self) -> Result<()>
Create the WAL directory if it doesn’t exist
Auto Trait Implementations§
impl Freeze for SegmentManager
impl RefUnwindSafe for SegmentManager
impl Send for SegmentManager
impl Sync for SegmentManager
impl Unpin for SegmentManager
impl UnwindSafe for SegmentManager
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