pub enum Retention {
CalendarYears(u32),
Rolling(Duration),
}Expand description
When personal metering values stop being personal.
Two shapes, because § 60 Abs. 6 MsbG has two triggers and only one of them is a clock. The Messstellenbetreiber must erase or anonymise personenbezogene Messwerte as soon as storing them is no longer necessary, “spätestens jedoch nach drei Jahren ab dem Schluss des Kalenderjahres, in dem der jeweilige Messwert erhoben wurde”. Three years is the ceiling; the operative trigger is earlier and is a business decision.
A policy turns an instant into the cutoff a sweep applies to the latest
reading each subject explains — see
MeterCatalog::anonymise_before.
Variants§
CalendarYears(u32)
The statutory shape: years full calendar years after the end of the one
a value was collected in.
Not now - years, which is the tempting spelling and is wrong by up
to a year in the direction that erases data still within its period. The
deadline for a value collected on 2 January 2025 is 31 December 2028, not
2 January 2028, because the clock starts at the Schluss des
Kalenderjahres. The year is Berlin’s, because the statute is.
Rolling(Duration)
A rolling window — the earlier “no longer necessary” trigger, where a deployment has decided what that means.
Implementations§
Source§impl Retention
impl Retention
Sourcepub fn cutoff(self, now: OffsetDateTime) -> OffsetDateTime
pub fn cutoff(self, now: OffsetDateTime) -> OffsetDateTime
The instant a sweep run at now treats as the ceiling: a subject is due
once every reading it explains starts strictly before this.
use meterstore::Retention;
use time::macros::datetime;
// Values collected in 2024 come due at the end of 2027, so a sweep any
// time in 2028 covers them — and leaves 2025's alone until 2029.
let cutoff = Retention::CalendarYears(3).cutoff(datetime!(2028-06-01 00:00 UTC));
assert_eq!(cutoff, datetime!(2024-12-31 23:00 UTC)); // 2025-01-01 Berlin§Both arms saturate towards nothing is due
A period wider than the calendar can express means “keep everything”. The other reading — subtract nothing, so the cutoff is this year — makes every subject in the store due at once, and erasure has no undo.
use meterstore::Retention;
use time::macros::datetime;
let now = datetime!(2028-06-01 00:00 UTC);
// A period nothing can be older than: nothing comes due.
assert!(Retention::CalendarYears(u32::MAX).cutoff(now) < datetime!(1970-01-01 00:00 UTC));
assert!(Retention::Rolling(time::Duration::MAX).cutoff(now) < now);Trait Implementations§
impl Copy for Retention
impl Eq for Retention
impl StructuralPartialEq for Retention
Auto Trait Implementations§
impl Freeze for Retention
impl RefUnwindSafe for Retention
impl Send for Retention
impl Sync for Retention
impl Unpin for Retention
impl UnsafeUnpin for Retention
impl UnwindSafe for Retention
Blanket Implementations§
impl<T> Allocation for T
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> Downcast for T
impl<T> Downcast for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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