Expand description
Pure snapshot-selection helpers shared by the controller and the mover.
Restore resolution picks a snapshot from a kopia snapshot list by an
optional point-in-time cutoff (asOf) and a zero-based offset (0 = newest).
These two operations are pure functions over an already-fetched, newest-first
list, so they live here (next to crate::SnapshotListEntry) rather than in
either binary — the mover resolves object-store restores in-Job and the
controller’s tests exercise the same logic. The RFC3339 parse of the asOf
string is the caller’s concern (the admission webhook validates it; callers
re-parse defensively) so these stay infallible.
Functions§
- filter_
as_ of - Keep only snapshots taken at or before
cutoff(point-in-time selection), preserving order so it composes withpick_offset: filter first, then offset (“the previous one as of last Tuesday”).Nonekeeps the full list. - pick_
offset - Pick the snapshot at
offset(0 = newest) from a newest-first list. A negative offset clamps to the newest rather than panicking; an out-of-range offset returnsNone(the caller appliesonMissingSnapshot).