Skip to main content

Module selection

Module selection 

Source
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 with pick_offset: filter first, then offset (“the previous one as of last Tuesday”). None keeps 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 returns None (the caller applies onMissingSnapshot).