pub struct RetentionPolicy { /* private fields */ }Expand description
The periods a deployment keeps its records for.
Implementations§
Source§impl RetentionPolicy
impl RetentionPolicy
Sourcepub fn declare(
years: u16,
categories: &BTreeMap<String, u16>,
origins: &BTreeMap<String, u16>,
map: &CategoryMap,
) -> Result<Self, RetentionError>
pub fn declare( years: u16, categories: &BTreeMap<String, u16>, origins: &BTreeMap<String, u16>, map: &CategoryMap, ) -> Result<Self, RetentionError>
The policy, inside the Union, that keeps every record years, the
data of each category of categories and from each origin of
origins as long as they say, in whole years, each category read as
CategoryMap::category reads it.
§Errors
A RetentionError for a period under FLOOR_YEARS, a code that
names no category, and an empty or malformed origin key.
Sourcepub fn declare_within(
bounds: &Bounds,
default: Period,
categories: &BTreeMap<String, Period>,
origins: &BTreeMap<String, Period>,
map: &CategoryMap,
) -> Result<Self, RetentionError>
pub fn declare_within( bounds: &Bounds, default: Period, categories: &BTreeMap<String, Period>, origins: &BTreeMap<String, Period>, map: &CategoryMap, ) -> Result<Self, RetentionError>
The policy within bounds that keeps every record default, the
data of each category of categories and from each origin of
origins (by its key: its endpoint, or the system_id of an origin
that names no endpoint) as long as they say.
§Errors
A RetentionError for a period outside the bounds, a code that
names no category, and an empty or malformed origin key.
Sourcepub fn longest(&self) -> Period
pub fn longest(&self) -> Period
The longest period the policy declares anywhere, by the fewest days
each spans; RetentionPolicy::retain compares by the end date each
gives a record instead.
Sourcepub fn retain<'a>(
&self,
recorded: Timestamp,
classified: &Classification,
origins: impl IntoIterator<Item = &'a str>,
) -> Retention
pub fn retain<'a>( &self, recorded: Timestamp, classified: &Classification, origins: impl IntoIterator<Item = &'a str>, ) -> Retention
How long the record of an access made at recorded, classified as
classified, from the origins keyed origins, is kept.
The period is the longest of the default, each category’s and each origin’s, and the longest declared anywhere for an access that is unclassified in whole or in part, each compared by the end date it gives this record. The ground is the first of these, in that order, that calls for the period.