pub struct ExpireSnapshotsAction { /* private fields */ }Expand description
A transaction action that removes snapshots from table metadata.
This only rewrites metadata; the now-unreferenced data and metadata files are left untouched. Physical file cleanup is the responsibility of a higher-level maintenance operation built on top of this action.
Selection follows Java RemoveSnapshots:
- Explicit ids (
expire_snapshot_ids) and age-based expiry are combined: a snapshot is expired if it is named explicitly or selected by age. - Age-based expiry always runs. The cutoff is
expire_older_than_mswhen set, a per-branchmax_snapshot_age_msfor that branch, otherwisenow - history.expire.max-snapshot-age-ms(default 5 days), matching Java’s constructor default. - Expiry is computed per branch along each branch’s ancestry: each branch keeps its most recent
retain_lastsnapshots — defaulting tohistory.expire.min-snapshots-to-keep, with a per-refmin_snapshots_to_keepoverriding both — plus any ancestor newer than the cutoff, so a shared ancestor reachable from a retained branch is never expired. - Refs are aged out first: a non-
mainbranch or tag whose head is older than itsmax_ref_age_ms(defaulting tohistory.expire.max-ref-age-ms) is removed, and snapshots only that ref retained then become expirable. - Heads of retained refs (including the current snapshot) are never expired, and naming one
explicitly is an error, since
remove_snapshotswould otherwise drop the ref silently.
Implementations§
Source§impl ExpireSnapshotsAction
impl ExpireSnapshotsAction
Sourcepub fn expire_snapshot_ids(
self,
snapshot_ids: impl IntoIterator<Item = i64>,
) -> Self
pub fn expire_snapshot_ids( self, snapshot_ids: impl IntoIterator<Item = i64>, ) -> Self
Expire these snapshot ids in addition to any age-based selection.
Age-based expiry runs by default (see the type-level docs), so a call that only names ids
still expires snapshots older than history.expire.max-snapshot-age-ms. Pin
expire_older_than_ms to a very old timestamp to expire by id
alone.
Ids accumulate across calls (like add_data_files).
An id that is still referenced by a branch or tag cannot be expired and causes commits to fail.
Sourcepub fn expire_older_than_ms(self, older_than_ms: i64) -> Self
pub fn expire_older_than_ms(self, older_than_ms: i64) -> Self
Expire snapshots whose timestamp is strictly older than older_than_ms.
Sourcepub fn retain_last(self, retain_last: usize) -> Self
pub fn retain_last(self, retain_last: usize) -> Self
Keep at least the retain_last most recent snapshots of each branch when expiring by age
(defaults to the table’s history.expire.min-snapshots-to-keep, must be at least 1).
This only bounds the age cutoff; it does not protect snapshots named via
expire_snapshot_ids. Setting it to 0 makes commit fail.
Auto Trait Implementations§
impl Freeze for ExpireSnapshotsAction
impl RefUnwindSafe for ExpireSnapshotsAction
impl Send for ExpireSnapshotsAction
impl Sync for ExpireSnapshotsAction
impl Unpin for ExpireSnapshotsAction
impl UnsafeUnpin for ExpireSnapshotsAction
impl UnwindSafe for ExpireSnapshotsAction
Blanket Implementations§
Source§impl<T> ApplyTransactionAction for Twhere
T: TransactionAction + 'static,
impl<T> ApplyTransactionAction for Twhere
T: TransactionAction + 'static,
Source§fn apply(self, tx: Transaction) -> Result<Transaction, Error>
fn apply(self, tx: Transaction) -> Result<Transaction, Error>
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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