Skip to content

garbage-collection clarification needed #406

@rogpeppe

Description

@rogpeppe

As a newcomer to OCI registries, looking through the docs, I wasn't able to easily find out how the overall referential data model works. For example, until I discovered otherwise, I assumed that a manifest in one repository would be able to directly reference a blob that was uploaded to another repository within the same registry. Likewise, I haven't found a place that explicitly defines when a blob might be deleted by the garbage collector.

I came up with the following form of words to try to explain my understanding of the rules as I've come to understand them over the last few days. Does this accurately describe the intended semantics? Perhaps the spec could contain something like this.

GC rules for OCI registries

A registry holds a set of repositories. Each repository in a registry is logically separate from all other repositories, although actual content MAY be shared between them.

A repository holds a set of objects that it retains references to. When an object is no longer needed by a repository, it is released, which MAY remove the underlying data if it's not referred to by any other repository.

The object of garbage collection is to release any objects that aren't needed by the repository. After garbage collection, all objects not marked as live are released.

When a manifest or tag is created, any objects that it references MUST be live.

There are three categories of object: a manifest, a manifest list, and a blob. Blobs are data-only: they do not hold references to other objects.

The set of live objects is defined as follows:

  • for all tags T, the object referred to by T is live.
  • if a manifest list is live, all the manifests in the list are live
  • if a manifest is live, its config blob and all blobs in its layers are live.
  • if object B is live and manifest A has subject B, A is live.

All live objects MUST be retained by the repository and not deleted.

See also #378

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions