Rename wrap_with_hash to a more generic wrap_with_handler
This commit is contained in:
parent
d9973af1df
commit
84458811d5
2 changed files with 5 additions and 4 deletions
|
@ -14,7 +14,7 @@ from endpoints.v2.errors import BlobUnknown, BlobUploadInvalid, BlobUploadUnknow
|
||||||
from auth.jwt_auth import process_jwt_auth
|
from auth.jwt_auth import process_jwt_auth
|
||||||
from endpoints.decorators import anon_protect
|
from endpoints.decorators import anon_protect
|
||||||
from util.cache import cache_control
|
from util.cache import cache_control
|
||||||
from util.registry.filelike import wrap_with_hash
|
from util.registry.filelike import wrap_with_handler
|
||||||
from storage.basestorage import InvalidChunkException
|
from storage.basestorage import InvalidChunkException
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,7 +201,8 @@ def _upload_chunk(namespace, repo_name, upload_uuid):
|
||||||
except _InvalidRangeHeader:
|
except _InvalidRangeHeader:
|
||||||
_range_not_satisfiable(found.byte_count)
|
_range_not_satisfiable(found.byte_count)
|
||||||
|
|
||||||
input_fp = wrap_with_hash(get_input_stream(request), found.sha_state)
|
input_fp = get_input_stream(request)
|
||||||
|
input_fp = wrap_with_handler(input_fp, found.sha_state.update)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
length_written = storage.stream_upload_chunk({found.location.name}, upload_uuid, start_offset,
|
length_written = storage.stream_upload_chunk({found.location.name}, upload_uuid, start_offset,
|
||||||
|
|
|
@ -18,7 +18,7 @@ class SocketReader(object):
|
||||||
raise IOError('Stream is not seekable.')
|
raise IOError('Stream is not seekable.')
|
||||||
|
|
||||||
|
|
||||||
def wrap_with_hash(in_fp, hash_obj):
|
def wrap_with_handler(in_fp, handler):
|
||||||
wrapper = SocketReader(in_fp)
|
wrapper = SocketReader(in_fp)
|
||||||
wrapper.add_handler(hash_obj.update)
|
wrapper.add_handler(handler)
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
Reference in a new issue