Index: tools/telemetry/third_party/gsutilz/gslib/cloud_api_helper.py |
diff --git a/tools/telemetry/third_party/gsutilz/gslib/cloud_api_helper.py b/tools/telemetry/third_party/gsutilz/gslib/cloud_api_helper.py |
index c570bb15dfed8bfbfa58ef5836be3040d72e1940..f7fc930266ac03a687af9e78d34759000cc0f843 100644 |
--- a/tools/telemetry/third_party/gsutilz/gslib/cloud_api_helper.py |
+++ b/tools/telemetry/third_party/gsutilz/gslib/cloud_api_helper.py |
@@ -16,6 +16,8 @@ |
from __future__ import absolute_import |
+import json |
+ |
from gslib.cloud_api import ArgumentException |
@@ -39,13 +41,12 @@ def ValidateDstObjectMetadata(dst_obj_metadata): |
'Object metadata supplied for destination object had no bucket name.') |
-def GetDownloadSerializationDict(src_obj_metadata): |
- """Returns a baseline serialization dict from the source object metadata. |
+def GetDownloadSerializationData(src_obj_metadata, progress=0): |
+ """Returns download serialization data. |
There are four entries: |
auto_transfer: JSON-specific field, always False. |
- progress: How much of the download has already been completed. Caller |
- should override this value if the download is being resumed. |
+ progress: How much of the download has already been completed. |
total_size: Total object size. |
url: Implementation-specific field used for saving a metadata get call. |
For JSON, this the download URL of the object. |
@@ -53,13 +54,17 @@ def GetDownloadSerializationDict(src_obj_metadata): |
Args: |
src_obj_metadata: Object to be downloaded. |
+ progress: See above. |
Returns: |
- Serialization dict for use with Cloud API GetObjectMedia. |
+ Serialization data for use with Cloud API GetObjectMedia. |
""" |
- return { |
+ |
+ serialization_dict = { |
'auto_transfer': 'False', |
- 'progress': 0, |
+ 'progress': progress, |
'total_size': src_obj_metadata.size, |
'url': src_obj_metadata.mediaLink |
} |
+ |
+ return json.dumps(serialization_dict) |