Skip to content

housekeeping: Let strategies control expiration grace period

Patrick Steinhardt requested to merge pks-housekeeping-prune-objects-config into master

When pruning objects we have a default grace period of two weeks. This grace period is dictated by housekeeping.OptimizeRepository(), which has this limit hardcoded. This has two issues:

- `OptimizeRepository()` should not be responsible for the policy of
  when exactly we perform certain optimizations. This is the job of
  the optimization strategy instead.

- We pass the expiration grace period as approxidate to git-prune(1)
  and thus have no fine-grained control of which objects exactly get
  pruned. This will become a problem once we introduce cruft packs,
  where we will then need to use the same date both when creating
  the cruft packs and when pruning objects.

Introduce a new PruneObjects() helper function along with a config struct that allows the caller to set the exact date before which objects shall be pruned. This allows us to easily move control of that expiry date into optimization strategies.

Part of #4351 (closed).

Merge request reports