Skip to main content

FrameShipper

Struct FrameShipper 

Source
pub struct FrameShipper { /* private fields */ }

Implementations§

Source§

impl FrameShipper

Source

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

Source

pub fn last_sync(&self) -> Arc<Mutex<Instant>> ⓘ

Source

pub fn sync_notify(&self) -> Arc<Notify> ⓘ

Source

pub async fn run(&self)

Source

pub async fn sync_once(&self) -> Result<bool>

Source

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_frames count (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.

Source

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
  1. List all L0 segments under the current salt prefix
  2. Filter out segments already covered by existing L1 files
  3. If fewer than compaction_min_segments eligible L0s, skip
  4. Merge eligible L0s into a single L1 file
  5. Upload the L1, update the manifest
  6. GC will delete the L0s in the next cycle

Returns the number of L0 segments compacted.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more