Add new Manifest, ManifestLabel, ManifestLegacyImage and ManifestBlob tables and start writing and GCing to/from them
This change also starts passing in the manifest interface, rather than the raw data, to the model for writing. Note that this change does *not* backfill the existing rows in to the new tables; that will occur in a followup PR. The new columns in `tagmanifest` and `tagmanifestlabel` will be used to track the backfill, as it will occur in a worker.
This commit is contained in:
parent
36c7482385
commit
a46660a06f
13 changed files with 476 additions and 120 deletions
|
@ -11,9 +11,10 @@ from endpoints.v2.models_interface import (
|
|||
RepositoryReference,
|
||||
Tag,)
|
||||
from image.docker.v1 import DockerV1Metadata
|
||||
from image.docker.interfaces import ManifestInterface
|
||||
from image.docker.schema1 import DOCKER_SCHEMA1_SIGNED_MANIFEST_CONTENT_TYPE
|
||||
|
||||
_MEDIA_TYPE = "application/vnd.docker.distribution.manifest.v1+prettyjws"
|
||||
|
||||
_MEDIA_TYPE = DOCKER_SCHEMA1_SIGNED_MANIFEST_CONTENT_TYPE
|
||||
|
||||
class PreOCIModel(DockerRegistryV2DataInterface):
|
||||
"""
|
||||
|
@ -90,11 +91,10 @@ class PreOCIModel(DockerRegistryV2DataInterface):
|
|||
parents = model.image.get_parent_images(namespace_name, repo_name, repo_image)
|
||||
return [_docker_v1_metadata(namespace_name, repo_name, image) for image in parents]
|
||||
|
||||
def create_manifest_and_update_tag(self, namespace_name, repo_name, tag_name, manifest_digest,
|
||||
manifest_bytes):
|
||||
def create_manifest_and_update_tag(self, namespace_name, repo_name, tag_name, manifest):
|
||||
assert isinstance(manifest, ManifestInterface)
|
||||
try:
|
||||
model.tag.associate_generated_tag_manifest(namespace_name, repo_name, tag_name,
|
||||
manifest_digest, manifest_bytes)
|
||||
model.tag.associate_generated_tag_manifest(namespace_name, repo_name, tag_name, manifest)
|
||||
except IntegrityError:
|
||||
# It's already there!
|
||||
pass
|
||||
|
@ -112,10 +112,10 @@ class PreOCIModel(DockerRegistryV2DataInterface):
|
|||
parent_image)
|
||||
return _docker_v1_metadata(repository.namespace_name, repository.name, repo_image)
|
||||
|
||||
def save_manifest(self, repository, tag_name, leaf_layer_docker_id, manifest_digest,
|
||||
manifest_bytes):
|
||||
(_, newly_created) = model.tag.store_tag_manifest_for_repo(
|
||||
repository.id, tag_name, leaf_layer_docker_id, manifest_digest, manifest_bytes)
|
||||
def save_manifest(self, repository, tag_name, manifest, leaf_layer_id=None):
|
||||
assert isinstance(manifest, ManifestInterface)
|
||||
(_, newly_created) = model.tag.store_tag_manifest_for_repo(repository.id, tag_name, manifest,
|
||||
leaf_layer_id=leaf_layer_id)
|
||||
return newly_created
|
||||
|
||||
def repository_tags(self, namespace_name, repo_name, start_id, limit):
|
||||
|
|
Reference in a new issue