retention

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package retention holds the pure time-window math for the retention sweep (sweep in internal/cleanup, SQL in internal/repository) — unit-testable without a DB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCutoff

func DeleteCutoff(now time.Time, graceDays int) time.Time

DeleteCutoff returns the cutoff before which an archived doc is hard-deleted (archived earlier = past the reversible grace window).

func ExpiryCutoff

func ExpiryCutoff(now time.Time, thresholdDays, multiplier int) time.Time

ExpiryCutoff returns the cutoff before which a section counts as expired: a doc is an archive candidate when even its freshest section was verified before it. Window = multiplier × the doc_type's staleness threshold (days).

func WindowSafe

func WindowSafe(multiplier, graceDays int) bool

WindowSafe reports whether the retention window params are safe. A non-positive multiplier or grace collapses the cutoffs to "now", archiving then hard-deleting live docs wholesale — the sweep refuses when false. Defensive last line (audit #4).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL