Revert "Merge pull request #682 from jzelinskie/revertrevert"

This reverts commit 627ad25c9c, reversing
changes made to 31c392fecc.
This commit is contained in:
Jimmy Zelinskie 2015-10-22 16:02:07 -04:00
parent 24b7064140
commit 278bc736e3
10 changed files with 65 additions and 212 deletions

View file

@ -79,14 +79,7 @@ def get_repository_images_base(namespace_name, repository_name, query_modifier):
query = query_modifier(query)
return invert_placement_query_results(query)
def invert_placement_query_results(placement_query):
""" This method will take a query which returns placements, storages, and images, and have it
return images and their storages, along with the placement set on each storage.
"""
location_list = list(placement_query)
location_list = list(query)
images = {}
for location in location_list:
@ -341,6 +334,7 @@ def set_image_size(docker_image_id, namespace_name, repository_name, image_size,
try:
# TODO(jschorr): Switch to this faster route once we have full ancestor aggregate_size
# parent_image = Image.get(Image.id == ancestors[-1])
# total_size = image_size + parent_image.storage.aggregate_size
ancestor_size = (ImageStorage
.select(fn.Sum(ImageStorage.image_size))
.join(Image)
@ -349,7 +343,6 @@ def set_image_size(docker_image_id, namespace_name, repository_name, image_size,
# TODO stop writing to storage when all readers are removed
if ancestor_size is not None:
# total_size = image_size + parent_image.storage.aggregate_size
total_size = ancestor_size + image_size
image.storage.aggregate_size = total_size
image.aggregate_size = total_size