Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Unified Diff: tools/telemetry/third_party/gsutilz/gslib/cloud_api_helper.py

Issue 1376593003: Roll gsutil version to 4.15. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)
« no previous file with comments | « tools/telemetry/third_party/gsutilz/gslib/cloud_api_delegator.py ('k') | tools/telemetry/third_party/gsutilz/gslib/command.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698