Convert V2's tag endpoints to use the new data model interface
This commit is contained in:
parent
6b5064aba4
commit
e91ba98e1b
5 changed files with 31 additions and 7 deletions
|
@ -117,6 +117,11 @@ class Tag(datatype('Tag', ['name', 'reversion', 'manifest_digest', 'lifetime_sta
|
|||
"""
|
||||
return legacy_image
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
""" The ID of this tag for pagination purposes only. """
|
||||
return self._db_id
|
||||
|
||||
|
||||
class Manifest(datatype('Manifest', ['digest', 'media_type', 'manifest_bytes'])):
|
||||
""" Manifest represents a manifest in a repository. """
|
||||
|
|
|
@ -95,7 +95,9 @@ class RegistryDataInterface(object):
|
|||
"""
|
||||
|
||||
@abstractmethod
|
||||
def list_repository_tags(self, repository_ref, include_legacy_images=False):
|
||||
def list_repository_tags(self, repository_ref, include_legacy_images=False,
|
||||
start_pagination_id=None,
|
||||
limit=None):
|
||||
"""
|
||||
Returns a list of all the active tags in the repository. Note that this can be a *heavy*
|
||||
operation on repositories with a lot of tags, and should be avoided for more targetted
|
||||
|
|
|
@ -287,7 +287,9 @@ class PreOCIModel(RegistryDataInterface):
|
|||
"""
|
||||
return Label.for_label(model.label.delete_manifest_label(label_uuid, manifest._db_id))
|
||||
|
||||
def list_repository_tags(self, repository_ref, include_legacy_images=False):
|
||||
def list_repository_tags(self, repository_ref, include_legacy_images=False,
|
||||
start_pagination_id=None,
|
||||
limit=None):
|
||||
"""
|
||||
Returns a list of all the active tags in the repository. Note that this can be a *heavy*
|
||||
operation on repositories with a lot of tags, and should be avoided for more targetted
|
||||
|
@ -296,7 +298,7 @@ class PreOCIModel(RegistryDataInterface):
|
|||
# NOTE: include_legacy_images isn't used here because `list_active_repo_tags` includes the
|
||||
# information already, so we might as well just use it. However, the new model classes will
|
||||
# *not* include it by default, so we make it a parameter now.
|
||||
tags = model.tag.list_active_repo_tags(repository_ref._db_id)
|
||||
tags = model.tag.list_active_repo_tags(repository_ref._db_id, start_pagination_id, limit)
|
||||
return [Tag.for_repository_tag(tag,
|
||||
legacy_image=LegacyImage.for_image(tag.image),
|
||||
manifest_digest=(tag.tagmanifest.digest
|
||||
|
|
Reference in a new issue