This commit is contained in:
root 2013-11-11 21:40:24 +00:00
commit 58de257c4d
2 changed files with 16 additions and 1 deletions

View file

@ -114,7 +114,7 @@ def put_image_layer(namespace, repository, image_id):
# compute checksums
csums = []
sr = SocketReader(input_stream)
tmp, store_hndlr = storage.temp_store_handler()
tmp, store_hndlr = store.temp_store_handler()
sr.add_handler(store_hndlr)
h, sum_hndlr = checksums.simple_checksum_handler(json_data)
sr.add_handler(sum_hndlr)

View file

@ -1,3 +1,6 @@
import tempfile
class Storage(object):
"""Storage is organized as follow:
@ -13,6 +16,18 @@ class Storage(object):
# Set the IO buffer to 64kB
buffer_size = 64 * 1024
@staticmethod
def temp_store_handler():
tmpf = tempfile.TemporaryFile()
def fn(buf):
try:
tmpf.write(buf)
except IOError:
pass
return tmpf, fn
#FIXME(samalba): Move all path resolver in each module (out of the base)
def images_list_path(self, namespace, repository):
return '{0}/{1}/{2}/_images_list'.format(self.repositories,