buildpacks / imgutil

Helpful utilities for working with images
Apache License 2.0
24 stars 41 forks source link

Create an new interface to handle Manifest Lists #188

Closed jjbustamante closed 4 months ago

jjbustamante commented 1 year ago

Context

The OCI spec defines an Image Index concept to handle multiple manifests in an OCI image. Currently, we expose an Image interface that is consumed no matter the implementation (daemon, registry or layout), this is very convenient to decouple the implementation.

Requeriment

This issue suggests the definition and implementation of a new interface to expose the operations to deal with an Image Index .

Proposal

Note: I am using underscore to refer to a package, for example, foo_Bar referes to a Bar class in the foo package

classDiagram
    ManifestList <|-- remote_ManifestList
    ManifestList <|--  local_ManifestList 
    remote_ManifestList o-- ManifestListOption

    class ManifestListOption {
        +WithMediaTypes(requested imgutil.MediaTypes)
        +WithPath(path string)
    }

    class remote_ManifestList {
        +NewManifestList(repoName string, keychain authn.Keychain, ops []ManifestListOption) ManifestList 
    }

    class local_ManifestList {
         +NewManifestList(repoName string, path string, ops []ManifestListOption) ManifestList
    }

    class ManifestList {
       <<interface>>
        +Add(repoName string) error
        +Remove(repoName string) error
        +Save() error
    }

Notes