Move shared V1/V2 code into common methods and fix verbs

This commit is contained in:
Joseph Schorr 2015-08-13 17:14:17 -04:00
parent 0e93dbb832
commit d246e68e68
5 changed files with 42 additions and 28 deletions

View file

@ -216,3 +216,14 @@ def get_repo_storage_by_checksum(namespace, repository_name, checksum):
return _get_storage(filter_to_repo_and_checksum)
except InvalidImageException:
raise InvalidImageException('No storage found with checksum {0}'.format(checksum))
def get_layer_path(storage_record, store):
""" Returns the path in the storage engine to the layer data referenced by the storage row. """
if not storage_record.cas_path:
return store.v1_image_layer_path(storage_record.uuid)
return store.blob_path(storage_record.checksum)