From f63a0f888db9b9d046d4c0ebab571c16ae458e0d Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Tue, 7 Oct 2025 15:51:34 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(retention):=20implement=20data?= =?UTF-8?q?=20retention=20policy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - introduce `Retention` struct to define data retention period and label generation flag - add `MessageAge` enum to represent different retention time units (days, months, years) - implement default values for retention policy (5 years, generate label) --- src/retention.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/retention.rs diff --git a/src/retention.rs b/src/retention.rs new file mode 100644 index 0000000..b8532f9 --- /dev/null +++ b/src/retention.rs @@ -0,0 +1,36 @@ +mod message_age; + +pub use message_age::MessageAge; + +/// Define retention period and flag to indicate if label should be generated +#[derive(Debug)] +pub struct Retention { + age: MessageAge, + generate_label: bool, +} + +impl Default for Retention { + fn default() -> Self { + Self { + age: MessageAge::Years(5), + generate_label: true, + } + } +} + +impl Retention { + pub(crate) fn new(age: MessageAge, generate_label: bool) -> Self { + Retention { + age, + generate_label, + } + } + + pub(crate) fn age(&self) -> &MessageAge { + &self.age + } + + pub(crate) fn generate_label(&self) -> bool { + self.generate_label + } +}