Skip to content

housekeeping: Introduce the concept of optimization strategies

Patrick Steinhardt requested to merge pks-git-maintenance-strategies into master

Right now, OptimizeRepository only knows a single strategy to optimize repositories that is based on heuristics. As such, the infrastructure to determine whether some data structure of a repository needs to be optimized or not is tightly wedded to the mechanism. This has a number of drawbacks:

- It is hard to introduce different optimization strategies.

- The code is comparatively complex.

- It is hard to test the different concerns as standalone
  functionality.

- It is hard to reuse information to inform later decisions.

Introduce the concept of optimization strategies to fix these deficiencies. An optimization strategy encapsulates all information required to determine which parts need to be optimized and then encode the policy that acts on this data. With this separation of concerns we can easily introduce different strategies at a later point so that OptimizeRepository becomes the single point in our system that performs all optimizations.

Part of #4543 (closed).

Edited by Patrick Steinhardt

Merge request reports