Skip to main content

Module reference

Module reference 

Source
Expand description

Repository-name and reference parsing.

Spec: OCI Distribution Spec v1.1 §2 “Definitions”.

  • A repository <name> matches [a-z0-9]+(?:(?:(?:[._]|__|[-]*)[a-z0-9]+)+)?(?:/[a-z0-9]+(?:(?:(?:[._]|__|[-]*)[a-z0-9]+)+)?)* with a total length <= 255 characters.
  • A <reference> is either a tag (matching [a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}) or a digest (<algo>:<hex>).

The conformance suite exercises the edge cases (double underscores, leading uppercase, names ending with -) so we enforce the regex manually rather than rely on regex::Regex (which would pull an extra dep).

Enums§

Reference
A parsed manifest reference: either a tag or a digest.

Constants§

MAX_NAME_LENGTH
Maximum total length of a repository name (spec §2).
MAX_TAG_LENGTH
Maximum length of a tag reference (spec §2: 128 characters).

Functions§

validate_name
Validate a repository name against the OCI Distribution Spec v1.1 name grammar.