pub struct RetentionPolicy {
pub max_age_secs: Option<u64>,
pub max_size_bytes: Option<u64>,
}Expand description
Retention policy for the transaction log.
At least one bound must be set for TransactionLog::sweep to do
useful work; with both bounds set, sweep removes entries that
exceed either bound (logical OR — whichever is tighter wins).
Time-based sweep is the cheaper path: a single HLC threshold,
delete_range-friendly. Size-based sweep is more expensive because
it requires totaling on-disk bytes; expect implementations to
approximate (e.g., count entries and assume average size) rather
than exact byte accounting.
Fields§
§max_age_secs: Option<u64>Remove entries with physical-time component older than
now - max_age_secs. None disables age-based sweep.
max_size_bytes: Option<u64>Trim the log to at most this many on-disk bytes by removing
the oldest entries. None disables size-based sweep. Best-
effort: implementations may overshoot by one entry rather
than partial-truncate.
Implementations§
Source§impl RetentionPolicy
impl RetentionPolicy
Sourcepub const fn dual(max_age_secs: u64, max_size_bytes: u64) -> Self
pub const fn dual(max_age_secs: u64, max_size_bytes: u64) -> Self
Combined retention — sweep removes entries that exceed either bound.
Sourcepub const fn is_disabled(&self) -> bool
pub const fn is_disabled(&self) -> bool
True if no bound is set; TransactionLog::sweep is a no-op
in this case.
Trait Implementations§
Source§impl Clone for RetentionPolicy
impl Clone for RetentionPolicy
Source§fn clone(&self) -> RetentionPolicy
fn clone(&self) -> RetentionPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RetentionPolicy
Source§impl Debug for RetentionPolicy
impl Debug for RetentionPolicy
Source§impl Default for RetentionPolicy
impl Default for RetentionPolicy
Source§fn default() -> RetentionPolicy
fn default() -> RetentionPolicy
impl Eq for RetentionPolicy
Source§impl PartialEq for RetentionPolicy
impl PartialEq for RetentionPolicy
Source§fn eq(&self, other: &RetentionPolicy) -> bool
fn eq(&self, other: &RetentionPolicy) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RetentionPolicy
Auto Trait Implementations§
impl Freeze for RetentionPolicy
impl RefUnwindSafe for RetentionPolicy
impl Send for RetentionPolicy
impl Sync for RetentionPolicy
impl Unpin for RetentionPolicy
impl UnsafeUnpin for RetentionPolicy
impl UnwindSafe for RetentionPolicy
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.