From b68e1b5efc3d6300b2db0f736dae47673966ab67 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Wed, 3 Aug 2016 14:00:40 -0400 Subject: [PATCH] add "get_" prefix to all db read funcs --- data/model/v2.py | 6 +++--- endpoints/v2/blob.py | 4 ++-- endpoints/v2/manifest.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data/model/v2.py b/data/model/v2.py index 197ebebe0..12a9174ed 100644 --- a/data/model/v2.py +++ b/data/model/v2.py @@ -53,7 +53,7 @@ def delete_tag(namespace_name, repo_name, tag_name): return True -def docker_v1_metadata_by_tag(namespace_name, repo_name, tag_name): +def get_docker_v1_metadata_by_tag(namespace_name, repo_name, tag_name): if not repo_image: return None @@ -67,7 +67,7 @@ def docker_v1_metadata_by_tag(namespace_name, repo_name, tag_name): ) -def docker_v1_metadata_by_image_id(namespace_name, repo_name, image_ids): +def get_docker_v1_metadata_by_image_id(namespace_name, repo_name, image_ids): images_query = model.image.lookup_repository_images(repo, all_image_ids) return {image.docker_image_id: DockerV1Metadata(namespace_name=namespace_name, repo_name=repo_name, @@ -166,7 +166,7 @@ def create_blob_and_temp_tag(namespace_name, repo_name, expected_digest, upload_ upload_obj.uncompressed_byte_count) -def blob_by_digest(namespace_name, repo_name, digest): +def get_blob_by_digest(namespace_name, repo_name, digest): try: return model.blob.get_repo_blob_by_digest(namespace_name, repo_name, digest) except model.BlobDoesNotExist: diff --git a/endpoints/v2/blob.py b/endpoints/v2/blob.py index bd2dc2a5b..c3eabef38 100644 --- a/endpoints/v2/blob.py +++ b/endpoints/v2/blob.py @@ -41,7 +41,7 @@ class _InvalidRangeHeader(Exception): @cache_control(max_age=31436000) def check_blob_exists(namespace_name, repo_name, digest): # Find the blob. - blob = v2.blob_by_digest(namespace_name, repo_name, digest) + blob = v2.get_blob_by_digest(namespace_name, repo_name, digest) if blob is None: raise BlobUnknown() @@ -70,7 +70,7 @@ def check_blob_exists(namespace_name, repo_name, digest): @cache_control(max_age=31536000) def download_blob(namespace_name, repo_name, digest): # Find the blob. - blob = v2.blob_by_digest(namespace_name, repo_name, digest) + blob = v2.get_blob_by_digest(namespace_name, repo_name, digest) if blob is None: raise BlobUnknown() diff --git a/endpoints/v2/manifest.py b/endpoints/v2/manifest.py index a5adfac89..40a4445e2 100644 --- a/endpoints/v2/manifest.py +++ b/endpoints/v2/manifest.py @@ -155,7 +155,7 @@ def _write_manifest(namespace_name, repo_name, manifest): # Lookup all the images and their parent images (if any) inside the manifest. # This will let us know which v1 images we need to synthesize and which ones are invalid. all_image_ids = list(manifest.docker_image_ids | manifest.parent_image_ids) - images_map = v2.docker_v1_metadata_by_image_id(namespace_name, repo_name, all_image_ids) + images_map = v2.get_docker_v1_metadata_by_image_id(namespace_name, repo_name, all_image_ids) # Rewrite any v1 image IDs that do not match the checksum in the database. try: @@ -228,7 +228,7 @@ def delete_manifest_by_digest(namespace_name, repo_name, digest): def _generate_and_store_manifest(namespace_name, repo_name, tag_name): # Find the v1 metadata for this image and its parents. - v1_metadata = v2.docker_v1_metadata_by_tag(namespace_name, repo_name, tag_name) + v1_metadata = v2.get_docker_v1_metadata_by_tag(namespace_name, repo_name, tag_name) parents_v1_metadata = v2.get_parents_docker_v1_metadata(namespace_name, repo_name, v1_metadata.image_id)