Small optimization in manifest loading in the OCI data model
This commit is contained in:
parent
6c3eab47e0
commit
0d1ac7a4bb
3 changed files with 7 additions and 4 deletions
|
@ -42,7 +42,7 @@ class RegistryDataInterface(object):
|
|||
or None if none. """
|
||||
|
||||
@abstractmethod
|
||||
def get_manifest_for_tag(self, tag, backfill_if_necessary=False):
|
||||
def get_manifest_for_tag(self, tag, backfill_if_necessary=False, include_legacy_image=False):
|
||||
""" Returns the manifest associated with the given tag. """
|
||||
|
||||
@abstractmethod
|
||||
|
|
|
@ -114,9 +114,12 @@ class OCIModel(SharedModel, RegistryDataInterface):
|
|||
assert found_tag is None or not found_tag.hidden
|
||||
return Tag.for_tag(found_tag)
|
||||
|
||||
def get_manifest_for_tag(self, tag, backfill_if_necessary=False):
|
||||
def get_manifest_for_tag(self, tag, backfill_if_necessary=False, include_legacy_image=False):
|
||||
""" Returns the manifest associated with the given tag. """
|
||||
legacy_image = oci.shared.get_legacy_image_for_manifest(tag._manifest)
|
||||
legacy_image = None
|
||||
if include_legacy_image:
|
||||
legacy_image = oci.shared.get_legacy_image_for_manifest(tag._manifest)
|
||||
|
||||
return Manifest.for_manifest(tag._manifest, LegacyImage.for_image(legacy_image))
|
||||
|
||||
def lookup_manifest_by_digest(self, repository_ref, manifest_digest, allow_dead=False,
|
||||
|
|
|
@ -66,7 +66,7 @@ class PreOCIModel(SharedModel, RegistryDataInterface):
|
|||
assert found_tag is None or not found_tag.hidden
|
||||
return Tag.for_repository_tag(found_tag)
|
||||
|
||||
def get_manifest_for_tag(self, tag, backfill_if_necessary=False):
|
||||
def get_manifest_for_tag(self, tag, backfill_if_necessary=False, include_legacy_image=False):
|
||||
""" Returns the manifest associated with the given tag. """
|
||||
try:
|
||||
tag_manifest = database.TagManifest.get(tag_id=tag._db_id)
|
||||
|
|
Reference in a new issue