diff options
author | Timur Alperovich <timuralp@swiftstack.com> | 2017-06-28 12:02:21 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2018-01-18 04:56:12 +0000 |
commit | 2faea932870956583f83226886d33304ee1eee46 (patch) | |
tree | 0d23a3d3389d506d5564613c296e0e92736f5cd6 /swiftclient/shell.py | |
parent | a9b8f0a0d191873ac88b0c70166a2b889096fa69 (diff) | |
download | python-swiftclient-2faea932870956583f83226886d33304ee1eee46.tar.gz |
Allow for object uploads > 5GB from stdin.
When uploading from standard input, swiftclient should turn the upload
into an SLO in the case of large objects. This patch picks the
threshold as 10MB (and uses that as the default segment size). The
consumers can also supply the --segment-size option to alter that
threshold and the SLO segment size. The patch does buffer one segment
in memory (which is why 10MB default was chosen).
(test is updated)
Change-Id: Ib13e0b687bc85930c29fe9f151cf96bc53b2e594
Diffstat (limited to 'swiftclient/shell.py')
-rwxr-xr-x | swiftclient/shell.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/swiftclient/shell.py b/swiftclient/shell.py index 43fcf47..d02c709 100755 --- a/swiftclient/shell.py +++ b/swiftclient/shell.py @@ -947,6 +947,8 @@ Optional arguments: def st_upload(parser, args, output_manager): + DEFAULT_STDIN_SEGMENT = 10 * 1024 * 1024 + parser.add_argument( '-c', '--changed', action='store_true', dest='changed', default=False, help='Only upload files that have changed since ' @@ -1060,6 +1062,12 @@ def st_upload(parser, args, output_manager): st_upload_help) return + if from_stdin: + if not options['use_slo']: + options['use_slo'] = True + if not options['segment_size']: + options['segment_size'] = DEFAULT_STDIN_SEGMENT + options['object_uu_threads'] = options['object_threads'] with SwiftService(options=options) as swift: try: |