pub struct LifecycleRule { /* private fields */ }Expand description
A lifecycle rule for a bucket (see Bucket::lifecycle).
Each rule has an optional prefix and at least one action.
The storage provider applies rules asynchronously — typically within a day
after an object becomes eligible, and never earlier.
Day counts are measured from when an object was written (or, for noncurrent actions, from when a version was replaced or deleted). Specify them as integer literals between 1 and 36500 so Encore can parse them statically.
use encore::objects::{Bucket, LifecycleRule};
static LOGS: Bucket = Bucket::new("logs").lifecycle(&[LifecycleRule::new()
.prefix("app/")
.move_to_infrequent_after_days(30)
.move_to_cold_after_days(90)
.delete_after_days(365)]);Implementations§
Source§impl LifecycleRule
impl LifecycleRule
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a rule matching all objects in the bucket. Add at least one action before attaching it to a bucket.
Sourcepub const fn prefix(self, prefix: &'static str) -> Self
pub const fn prefix(self, prefix: &'static str) -> Self
Applies the rule only to objects whose names start with prefix.
Sourcepub const fn move_to_infrequent_after_days(self, days: u32) -> Self
pub const fn move_to_infrequent_after_days(self, days: u32) -> Self
Transitions matching objects to StorageClass::Infrequent after
days days (must be at least 30).
Sourcepub const fn move_to_cold_after_days(self, days: u32) -> Self
pub const fn move_to_cold_after_days(self, days: u32) -> Self
Transitions matching objects to StorageClass::Cold after days
days.
When combined with
move_to_infrequent_after_days,
this must be at least 30 days after the infrequent transition.
Sourcepub const fn delete_after_days(self, days: u32) -> Self
pub const fn delete_after_days(self, days: u32) -> Self
Deletes matching objects days days after they are written (must be
later than any storage-class transition in the same rule).
In a versioned bucket, deletion turns the object into a noncurrent
version, matching Bucket::remove.
Sourcepub const fn delete_noncurrent_after_days(self, days: u32) -> Self
pub const fn delete_noncurrent_after_days(self, days: u32) -> Self
For versioned buckets: deletes noncurrent versions days days after
they are replaced or removed.
Sourcepub const fn keep_noncurrent_versions(self, count: u32) -> Self
pub const fn keep_noncurrent_versions(self, count: u32) -> Self
For versioned buckets: retains at least the count newest noncurrent
versions of each object, deleting older noncurrent versions.
Trait Implementations§
Source§impl Clone for LifecycleRule
impl Clone for LifecycleRule
impl Copy for LifecycleRule
Source§impl Debug for LifecycleRule
impl Debug for LifecycleRule
Auto Trait Implementations§
impl Forget for LifecycleRule
impl Freeze for LifecycleRule
impl Move for LifecycleRule
impl RefUnwindSafe for LifecycleRule
impl Send for LifecycleRule
impl Sync for LifecycleRule
impl Unpin for LifecycleRule
impl UnsafeUnpin for LifecycleRulewhere
&'static str: UnsafeUnpin,
impl UnwindSafe for LifecycleRulewhere
&'static str: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request