pub struct LifecycleRule { /* private fields */ }Expand description
A rule of a bucket’s lifecycle: an optional
prefix and at least one action. The provider applies
it, usually within a day of an object becoming due, never early.
Days count from when an object was written or, for the noncurrent actions, from when a version was replaced or removed. They are whole numbers from 1 to 36500, written as literals: Encore reads them from the declaration.
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
A rule for every object in the bucket, with no actions yet: add at least one.
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
Moves an object to StorageClass::Infrequent this many days after
it was written: 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
Moves an object to StorageClass::Cold this many days after it was
written: with move_to_infrequent_after_days,
at least 30 days after that.
Sourcepub const fn delete_after_days(self, days: u32) -> Self
pub const fn delete_after_days(self, days: u32) -> Self
Deletes an object this many days after it was written, later than
the rule’s moves. In a versioned bucket it becomes a noncurrent
version, as Bucket::remove makes it.
Sourcepub const fn delete_noncurrent_after_days(self, days: u32) -> Self
pub const fn delete_noncurrent_after_days(self, days: u32) -> Self
Versioned buckets: deletes a noncurrent version this many days after it was replaced or removed.
Sourcepub const fn keep_noncurrent_versions(self, count: u32) -> Self
pub const fn keep_noncurrent_versions(self, count: u32) -> Self
Versioned buckets: never deletes the newest count noncurrent
versions of an object. On its own, deletes the noncurrent versions
beyond them.
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 LifecycleRule
impl UnwindSafe for LifecycleRule
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