pub struct FrameShipper { /* private fields */ }Implementations§
Source§impl FrameShipper
impl FrameShipper
pub fn new( config: Config, bucket: Arc<dyn BucketStore>, manifest: Arc<Mutex<Manifest>>, snapshot_trigger: Arc<Notify>, sync_notify: Arc<Notify>, wal_notify: Arc<Notify>, snapshot_version: Arc<AtomicU64>, force_snapshot: Arc<AtomicBool>, shipped_frames: Arc<AtomicU32>, metrics: Arc<dyn Metrics>, ) -> Self
pub fn last_sync(&self) -> Arc<Mutex<Instant>> ⓘ
pub fn sync_notify(&self) -> Arc<Notify> ⓘ
pub async fn run(&self)
pub async fn sync_once(&self) -> Result<bool>
Sourcepub async fn gc(&self) -> Result<u32>
pub async fn gc(&self) -> Result<u32>
Garbage collect orphaned WAL segments.
An orphaned segment is one that:
- Matches the current salt prefix (
wal/{salt_1}-{salt_2}/) - Has a start frame less than the current
shipped_framescount (i.e., it’s been superseded by newer segments)
Segments with start frame >= shipped_frames are ACTIVE and never deleted, even if they are still being written to.
Limitation: Only segments under the current salt prefix are considered. After a WAL salt change, segments from the previous salt are not cleaned up. These orphaned segments are harmless (they’re just stale data) but consume storage. A future enhancement could add a separate pass for old salt prefixes.
Returns the number of orphaned segments deleted.
Sourcepub async fn compact(&self) -> Result<u32>
pub async fn compact(&self) -> Result<u32>
Compact L0 segments into L1 files.
Compaction merges multiple small L0 .segment files into fewer,
larger L1 .l1 files. This reduces the number of GET requests
needed during restore and lowers storage costs.
§Algorithm
- List all L0 segments under the current salt prefix
- Filter out segments already covered by existing L1 files
- If fewer than
compaction_min_segmentseligible L0s, skip - Merge eligible L0s into a single L1 file
- Upload the L1, update the manifest
- GC will delete the L0s in the next cycle
Returns the number of L0 segments compacted.
Auto Trait Implementations§
impl !RefUnwindSafe for FrameShipper
impl !UnwindSafe for FrameShipper
impl Forget for FrameShipper
impl Freeze for FrameShipper
impl Move for FrameShipper
impl Send for FrameShipper
impl Sync for FrameShipper
impl Unpin for FrameShipper
impl UnsafeUnpin for FrameShipper
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
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