Struct bonsaidb_local::config::PersistenceThreshold
source · Expand description
A threshold controlling lazy commits. For a threshold to apply, both
number_of_changes
must be met or surpassed and duration
must have
elpased since the last commit.
A threshold with a duration of zero will not wait any time to persist
changes once the specified number_of_changes
has been met or surpassed.
Fields§
§number_of_changes: usize
The minimum number of changes that must have occurred for this threshold to apply.
duration: Duration
The amount of time that must elapse since the last write for this threshold to apply.
Implementations§
source§impl PersistenceThreshold
impl PersistenceThreshold
sourcepub const fn after_changes(number_of_changes: usize) -> Self
pub const fn after_changes(number_of_changes: usize) -> Self
Returns a threshold that applies after a number of changes have elapsed.
sourcepub const fn and_duration(self, duration: Duration) -> Self
pub const fn and_duration(self, duration: Duration) -> Self
Sets the duration of this threshold to duration
and returns self.
Trait Implementations§
source§impl Clone for PersistenceThreshold
impl Clone for PersistenceThreshold
source§fn clone(&self) -> PersistenceThreshold
fn clone(&self) -> PersistenceThreshold
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more