2018-08-13 22:09:05 +00:00
|
|
|
from abc import ABCMeta, abstractmethod
|
|
|
|
from six import add_metaclass
|
|
|
|
|
|
|
|
@add_metaclass(ABCMeta)
|
|
|
|
class RegistryDataInterface(object):
|
|
|
|
""" Interface for code to work with the registry data model. The registry data model consists
|
|
|
|
of all tables that store registry-specific information, such as Manifests, Blobs, Images,
|
|
|
|
and Labels.
|
|
|
|
"""
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def find_matching_tag(self, repository_ref, tag_names):
|
|
|
|
""" Finds an alive tag in the repository matching one of the given tag names and returns it
|
|
|
|
or None if none.
|
|
|
|
"""
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def get_most_recent_tag(self, repository_ref):
|
|
|
|
""" Returns the most recently pushed alive tag in the repository, if any. If none, returns
|
|
|
|
None.
|
|
|
|
"""
|
2018-08-17 20:45:27 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def lookup_repository(self, namespace_name, repo_name, kind_filter=None):
|
|
|
|
""" Looks up and returns a reference to the repository with the given namespace and name,
|
|
|
|
or None if none. """
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def get_manifest_for_tag(self, tag):
|
|
|
|
""" Returns the manifest associated with the given tag. """
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def lookup_manifest_by_digest(self, repository_ref, manifest_digest, allow_dead=False):
|
|
|
|
""" Looks up the manifest with the given digest under the given repository and returns it
|
|
|
|
or None if none. """
|
|
|
|
|
2018-08-17 22:34:10 +00:00
|
|
|
@abstractmethod
|
|
|
|
def get_legacy_images(self, repository_ref):
|
|
|
|
"""
|
|
|
|
Returns an iterator of all the LegacyImage's defined in the matching repository.
|
|
|
|
"""
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def get_legacy_image(self, repository_ref, docker_image_id, include_parents=False):
|
|
|
|
"""
|
|
|
|
Returns the matching LegacyImages under the matching repository, if any. If none,
|
|
|
|
returns None.
|
|
|
|
"""
|
2018-08-21 21:26:32 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def create_manifest_label(self, manifest, key, value, source_type_name, media_type_name=None):
|
|
|
|
""" Creates a label on the manifest with the given key and value.
|
|
|
|
|
|
|
|
Can raise InvalidLabelKeyException or InvalidMediaTypeException depending
|
|
|
|
on the validation errors.
|
|
|
|
"""
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def list_manifest_labels(self, manifest, key_prefix=None):
|
|
|
|
""" Returns all labels found on the manifest. If specified, the key_prefix will filter the
|
|
|
|
labels returned to those keys that start with the given prefix.
|
|
|
|
"""
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def get_manifest_label(self, manifest, label_uuid):
|
|
|
|
""" Returns the label with the specified UUID on the manifest or None if none. """
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def delete_manifest_label(self, manifest, label_uuid):
|
|
|
|
""" Delete the label with the specified UUID on the manifest. Returns the label deleted
|
|
|
|
or None if none.
|
|
|
|
"""
|