Add a timeline planner for OCI snapshot and delta tags

What does this MR do and why?

Adds Gitlab::PackageMetadata::Oci::Timeline, which turns a registry's tag names and the checkpoint into the steps to read.

  • Checkpoint inside the delta chain: read the deltas that continue from it, including deltas that overlap it. Ingestion upserts, so re-reading the overlap is safe.
  • Chain broken: read the newest snapshot past the checkpoint, then the chain after it.
  • No such snapshot: raise Gap, so a broken mirror is never skipped silently.
  • Full dataset pending: read the newest snapshot, resuming after the checkpoint chunk.
  • The chain is planned in one pass over the deltas sorted by start. A tag number of more than 19 digits does not match, so that tag is not planned.
  • A tag numbered above 2,147,483,647 does not fit the int4 checkpoint sequence. The planner leaves it out and lists it in out_of_range.

Safe alone: nothing calls the planner yet.

Part 5 of 7. Previous: feature/pmdb-oci-4-blobs. Next: feature/pmdb-oci-6-connector.

flowchart TD
    A[Checkpoint and tag names] --> B{Checkpoint inside the delta chain?}
    B -->|yes| C[Read the deltas that continue from it]
    B -->|no| D{Snapshot past the checkpoint?}
    D -->|yes| E[Read the newest snapshot, then the chain after it]
    D -->|no| F[Raise Gap]

Related to #642401

How to set up and validate locally

bundle exec rspec ee/spec/lib/gitlab/package_metadata/oci/timeline_spec.rb

MR acceptance checklist

  • The specs that cover this slice pass at ed23e5b73d: 657 examples in 14 spec files, 0 failures.
  • RuboCop reports no offenses on the changed files.

An AI coding assistant wrote this change. The assistant also ran RuboCop on the changed files and the specs above on a self-managed GitLab development instance on a test VM.

Edited by Andrew Dunn

Merge request reports

Loading
Loading