swift 2.23.3__py3-none-any.whl → 2.35.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- swift/__init__.py +29 -50
- swift/account/auditor.py +21 -118
- swift/account/backend.py +33 -28
- swift/account/reaper.py +37 -28
- swift/account/replicator.py +22 -0
- swift/account/server.py +60 -26
- swift/account/utils.py +28 -11
- swift-2.23.3.data/scripts/swift-account-audit → swift/cli/account_audit.py +23 -13
- swift-2.23.3.data/scripts/swift-config → swift/cli/config.py +2 -2
- swift/cli/container_deleter.py +5 -11
- swift-2.23.3.data/scripts/swift-dispersion-populate → swift/cli/dispersion_populate.py +8 -7
- swift/cli/dispersion_report.py +10 -9
- swift-2.23.3.data/scripts/swift-drive-audit → swift/cli/drive_audit.py +63 -21
- swift/cli/form_signature.py +3 -7
- swift-2.23.3.data/scripts/swift-get-nodes → swift/cli/get_nodes.py +8 -2
- swift/cli/info.py +154 -14
- swift/cli/manage_shard_ranges.py +705 -37
- swift-2.23.3.data/scripts/swift-oldies → swift/cli/oldies.py +25 -14
- swift-2.23.3.data/scripts/swift-orphans → swift/cli/orphans.py +7 -3
- swift/cli/recon.py +196 -67
- swift-2.23.3.data/scripts/swift-recon-cron → swift/cli/recon_cron.py +17 -20
- swift-2.23.3.data/scripts/swift-reconciler-enqueue → swift/cli/reconciler_enqueue.py +2 -3
- swift/cli/relinker.py +807 -126
- swift/cli/reload.py +135 -0
- swift/cli/ringbuilder.py +217 -20
- swift/cli/ringcomposer.py +0 -1
- swift/cli/shard-info.py +4 -3
- swift/common/base_storage_server.py +9 -20
- swift/common/bufferedhttp.py +48 -74
- swift/common/constraints.py +20 -15
- swift/common/container_sync_realms.py +9 -11
- swift/common/daemon.py +25 -8
- swift/common/db.py +195 -128
- swift/common/db_auditor.py +168 -0
- swift/common/db_replicator.py +95 -55
- swift/common/digest.py +141 -0
- swift/common/direct_client.py +144 -33
- swift/common/error_limiter.py +93 -0
- swift/common/exceptions.py +25 -1
- swift/common/header_key_dict.py +2 -9
- swift/common/http_protocol.py +373 -0
- swift/common/internal_client.py +129 -59
- swift/common/linkat.py +3 -4
- swift/common/manager.py +284 -67
- swift/common/memcached.py +390 -145
- swift/common/middleware/__init__.py +4 -0
- swift/common/middleware/account_quotas.py +211 -46
- swift/common/middleware/acl.py +3 -8
- swift/common/middleware/backend_ratelimit.py +230 -0
- swift/common/middleware/bulk.py +22 -34
- swift/common/middleware/catch_errors.py +1 -3
- swift/common/middleware/cname_lookup.py +6 -11
- swift/common/middleware/container_quotas.py +1 -1
- swift/common/middleware/container_sync.py +39 -17
- swift/common/middleware/copy.py +12 -0
- swift/common/middleware/crossdomain.py +22 -9
- swift/common/middleware/crypto/__init__.py +2 -1
- swift/common/middleware/crypto/crypto_utils.py +11 -15
- swift/common/middleware/crypto/decrypter.py +28 -11
- swift/common/middleware/crypto/encrypter.py +12 -17
- swift/common/middleware/crypto/keymaster.py +8 -15
- swift/common/middleware/crypto/kms_keymaster.py +2 -1
- swift/common/middleware/dlo.py +15 -11
- swift/common/middleware/domain_remap.py +5 -4
- swift/common/middleware/etag_quoter.py +128 -0
- swift/common/middleware/formpost.py +73 -70
- swift/common/middleware/gatekeeper.py +8 -1
- swift/common/middleware/keystoneauth.py +33 -3
- swift/common/middleware/list_endpoints.py +4 -4
- swift/common/middleware/listing_formats.py +85 -49
- swift/common/middleware/memcache.py +4 -95
- swift/common/middleware/name_check.py +3 -2
- swift/common/middleware/proxy_logging.py +160 -92
- swift/common/middleware/ratelimit.py +17 -10
- swift/common/middleware/read_only.py +6 -4
- swift/common/middleware/recon.py +59 -22
- swift/common/middleware/s3api/acl_handlers.py +25 -3
- swift/common/middleware/s3api/acl_utils.py +6 -1
- swift/common/middleware/s3api/controllers/__init__.py +6 -0
- swift/common/middleware/s3api/controllers/acl.py +3 -2
- swift/common/middleware/s3api/controllers/bucket.py +242 -137
- swift/common/middleware/s3api/controllers/logging.py +2 -2
- swift/common/middleware/s3api/controllers/multi_delete.py +43 -20
- swift/common/middleware/s3api/controllers/multi_upload.py +219 -133
- swift/common/middleware/s3api/controllers/obj.py +112 -8
- swift/common/middleware/s3api/controllers/object_lock.py +44 -0
- swift/common/middleware/s3api/controllers/s3_acl.py +2 -2
- swift/common/middleware/s3api/controllers/tagging.py +57 -0
- swift/common/middleware/s3api/controllers/versioning.py +36 -7
- swift/common/middleware/s3api/etree.py +22 -9
- swift/common/middleware/s3api/exception.py +0 -4
- swift/common/middleware/s3api/s3api.py +113 -41
- swift/common/middleware/s3api/s3request.py +384 -218
- swift/common/middleware/s3api/s3response.py +126 -23
- swift/common/middleware/s3api/s3token.py +16 -17
- swift/common/middleware/s3api/schema/delete.rng +1 -1
- swift/common/middleware/s3api/subresource.py +7 -10
- swift/common/middleware/s3api/utils.py +27 -10
- swift/common/middleware/slo.py +665 -358
- swift/common/middleware/staticweb.py +64 -37
- swift/common/middleware/symlink.py +51 -18
- swift/common/middleware/tempauth.py +76 -58
- swift/common/middleware/tempurl.py +191 -173
- swift/common/middleware/versioned_writes/__init__.py +51 -0
- swift/common/middleware/{versioned_writes.py → versioned_writes/legacy.py} +27 -26
- swift/common/middleware/versioned_writes/object_versioning.py +1482 -0
- swift/common/middleware/x_profile/exceptions.py +1 -4
- swift/common/middleware/x_profile/html_viewer.py +18 -19
- swift/common/middleware/x_profile/profile_model.py +1 -2
- swift/common/middleware/xprofile.py +10 -10
- swift-2.23.3.data/scripts/swift-container-server → swift/common/recon.py +13 -8
- swift/common/registry.py +147 -0
- swift/common/request_helpers.py +324 -57
- swift/common/ring/builder.py +67 -25
- swift/common/ring/composite_builder.py +1 -1
- swift/common/ring/ring.py +177 -51
- swift/common/ring/utils.py +1 -1
- swift/common/splice.py +10 -6
- swift/common/statsd_client.py +205 -0
- swift/common/storage_policy.py +49 -44
- swift/common/swob.py +86 -102
- swift/common/{utils.py → utils/__init__.py} +2163 -2772
- swift/common/utils/base.py +131 -0
- swift/common/utils/config.py +433 -0
- swift/common/utils/ipaddrs.py +256 -0
- swift/common/utils/libc.py +345 -0
- swift/common/utils/logs.py +859 -0
- swift/common/utils/timestamp.py +412 -0
- swift/common/wsgi.py +553 -535
- swift/container/auditor.py +14 -100
- swift/container/backend.py +490 -231
- swift/container/reconciler.py +126 -37
- swift/container/replicator.py +96 -22
- swift/container/server.py +358 -165
- swift/container/sharder.py +1540 -684
- swift/container/sync.py +94 -88
- swift/container/updater.py +53 -32
- swift/obj/auditor.py +153 -35
- swift/obj/diskfile.py +466 -217
- swift/obj/expirer.py +406 -124
- swift/obj/mem_diskfile.py +7 -4
- swift/obj/mem_server.py +1 -0
- swift/obj/reconstructor.py +523 -262
- swift/obj/replicator.py +249 -188
- swift/obj/server.py +207 -122
- swift/obj/ssync_receiver.py +145 -85
- swift/obj/ssync_sender.py +113 -54
- swift/obj/updater.py +652 -139
- swift/obj/watchers/__init__.py +0 -0
- swift/obj/watchers/dark_data.py +213 -0
- swift/proxy/controllers/account.py +11 -11
- swift/proxy/controllers/base.py +848 -604
- swift/proxy/controllers/container.py +433 -92
- swift/proxy/controllers/info.py +3 -2
- swift/proxy/controllers/obj.py +1000 -489
- swift/proxy/server.py +185 -112
- {swift-2.23.3.dist-info → swift-2.35.0.dist-info}/AUTHORS +58 -11
- {swift-2.23.3.dist-info → swift-2.35.0.dist-info}/METADATA +51 -56
- swift-2.35.0.dist-info/RECORD +201 -0
- {swift-2.23.3.dist-info → swift-2.35.0.dist-info}/WHEEL +1 -1
- {swift-2.23.3.dist-info → swift-2.35.0.dist-info}/entry_points.txt +43 -0
- swift-2.35.0.dist-info/pbr.json +1 -0
- swift/locale/de/LC_MESSAGES/swift.po +0 -1216
- swift/locale/en_GB/LC_MESSAGES/swift.po +0 -1207
- swift/locale/es/LC_MESSAGES/swift.po +0 -1085
- swift/locale/fr/LC_MESSAGES/swift.po +0 -909
- swift/locale/it/LC_MESSAGES/swift.po +0 -894
- swift/locale/ja/LC_MESSAGES/swift.po +0 -965
- swift/locale/ko_KR/LC_MESSAGES/swift.po +0 -964
- swift/locale/pt_BR/LC_MESSAGES/swift.po +0 -881
- swift/locale/ru/LC_MESSAGES/swift.po +0 -891
- swift/locale/tr_TR/LC_MESSAGES/swift.po +0 -832
- swift/locale/zh_CN/LC_MESSAGES/swift.po +0 -833
- swift/locale/zh_TW/LC_MESSAGES/swift.po +0 -838
- swift-2.23.3.data/scripts/swift-account-auditor +0 -23
- swift-2.23.3.data/scripts/swift-account-info +0 -51
- swift-2.23.3.data/scripts/swift-account-reaper +0 -23
- swift-2.23.3.data/scripts/swift-account-replicator +0 -34
- swift-2.23.3.data/scripts/swift-account-server +0 -23
- swift-2.23.3.data/scripts/swift-container-auditor +0 -23
- swift-2.23.3.data/scripts/swift-container-info +0 -55
- swift-2.23.3.data/scripts/swift-container-reconciler +0 -21
- swift-2.23.3.data/scripts/swift-container-replicator +0 -34
- swift-2.23.3.data/scripts/swift-container-sharder +0 -37
- swift-2.23.3.data/scripts/swift-container-sync +0 -23
- swift-2.23.3.data/scripts/swift-container-updater +0 -23
- swift-2.23.3.data/scripts/swift-dispersion-report +0 -24
- swift-2.23.3.data/scripts/swift-form-signature +0 -20
- swift-2.23.3.data/scripts/swift-init +0 -119
- swift-2.23.3.data/scripts/swift-object-auditor +0 -29
- swift-2.23.3.data/scripts/swift-object-expirer +0 -33
- swift-2.23.3.data/scripts/swift-object-info +0 -60
- swift-2.23.3.data/scripts/swift-object-reconstructor +0 -33
- swift-2.23.3.data/scripts/swift-object-relinker +0 -41
- swift-2.23.3.data/scripts/swift-object-replicator +0 -37
- swift-2.23.3.data/scripts/swift-object-server +0 -27
- swift-2.23.3.data/scripts/swift-object-updater +0 -23
- swift-2.23.3.data/scripts/swift-proxy-server +0 -23
- swift-2.23.3.data/scripts/swift-recon +0 -24
- swift-2.23.3.data/scripts/swift-ring-builder +0 -24
- swift-2.23.3.data/scripts/swift-ring-builder-analyzer +0 -22
- swift-2.23.3.data/scripts/swift-ring-composer +0 -22
- swift-2.23.3.dist-info/RECORD +0 -220
- swift-2.23.3.dist-info/pbr.json +0 -1
- {swift-2.23.3.dist-info → swift-2.35.0.dist-info}/LICENSE +0 -0
- {swift-2.23.3.dist-info → swift-2.35.0.dist-info}/top_level.txt +0 -0
@@ -14,6 +14,11 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
16
|
"""
|
17
|
+
.. note::
|
18
|
+
This middleware supports two legacy modes of object versioning that is
|
19
|
+
now replaced by a new mode. It is recommended to use the new
|
20
|
+
:ref:`Object Versioning <object_versioning>` mode for new containers.
|
21
|
+
|
17
22
|
Object versioning in swift is implemented by setting a flag on the container
|
18
23
|
to tell swift to version all objects in the container. The value of the flag is
|
19
24
|
the URL-encoded container name where the versions are stored (commonly referred
|
@@ -225,7 +230,7 @@ import json
|
|
225
230
|
import time
|
226
231
|
|
227
232
|
from swift.common.utils import get_logger, Timestamp, \
|
228
|
-
|
233
|
+
config_true_value, close_if_possible, FileLikeIter, drain_and_close
|
229
234
|
from swift.common.request_helpers import get_sys_meta_prefix, \
|
230
235
|
copy_header_subset
|
231
236
|
from swift.common.wsgi import WSGIContext, make_pre_authed_request
|
@@ -336,7 +341,8 @@ class VersionedWritesContext(WSGIContext):
|
|
336
341
|
lreq.environ['QUERY_STRING'] += '&reverse=on'
|
337
342
|
lresp = lreq.get_response(self.app)
|
338
343
|
if not is_success(lresp.status_int):
|
339
|
-
|
344
|
+
# errors should be short
|
345
|
+
drain_and_close(lresp)
|
340
346
|
if lresp.status_int == HTTP_NOT_FOUND:
|
341
347
|
raise ListingIterNotFound()
|
342
348
|
elif is_client_error(lresp.status_int):
|
@@ -377,6 +383,8 @@ class VersionedWritesContext(WSGIContext):
|
|
377
383
|
|
378
384
|
if source_resp.content_length is None or \
|
379
385
|
source_resp.content_length > MAX_FILE_SIZE:
|
386
|
+
# Consciously *don't* drain the response before closing;
|
387
|
+
# any logged 499 is actually rather appropriate here
|
380
388
|
close_if_possible(source_resp.app_iter)
|
381
389
|
return HTTPRequestEntityTooLarge(request=req)
|
382
390
|
|
@@ -397,6 +405,7 @@ class VersionedWritesContext(WSGIContext):
|
|
397
405
|
|
398
406
|
put_req.environ['wsgi.input'] = FileLikeIter(source_resp.app_iter)
|
399
407
|
put_resp = put_req.get_response(self.app)
|
408
|
+
# the PUT was responsible for draining
|
400
409
|
close_if_possible(source_resp.app_iter)
|
401
410
|
return put_resp
|
402
411
|
|
@@ -406,7 +415,8 @@ class VersionedWritesContext(WSGIContext):
|
|
406
415
|
"""
|
407
416
|
if is_success(resp.status_int):
|
408
417
|
return
|
409
|
-
|
418
|
+
# any error should be short
|
419
|
+
drain_and_close(resp)
|
410
420
|
if is_client_error(resp.status_int):
|
411
421
|
# missing container or bad permissions
|
412
422
|
raise HTTPPreconditionFailed(request=req)
|
@@ -429,7 +439,7 @@ class VersionedWritesContext(WSGIContext):
|
|
429
439
|
# making any backend requests
|
430
440
|
if 'swift.authorize' in req.environ:
|
431
441
|
container_info = get_container_info(
|
432
|
-
req.environ, self.app)
|
442
|
+
req.environ, self.app, swift_source='VW')
|
433
443
|
req.acl = container_info.get('write_acl')
|
434
444
|
aresp = req.environ['swift.authorize'](req)
|
435
445
|
if aresp:
|
@@ -439,7 +449,7 @@ class VersionedWritesContext(WSGIContext):
|
|
439
449
|
|
440
450
|
if get_resp.status_int == HTTP_NOT_FOUND:
|
441
451
|
# nothing to version, proceed with original request
|
442
|
-
|
452
|
+
drain_and_close(get_resp)
|
443
453
|
return
|
444
454
|
|
445
455
|
# check for any other errors
|
@@ -457,10 +467,12 @@ class VersionedWritesContext(WSGIContext):
|
|
457
467
|
|
458
468
|
put_path_info = "/%s/%s/%s/%s" % (
|
459
469
|
api_version, account_name, versions_cont, vers_obj_name)
|
470
|
+
req.environ['QUERY_STRING'] = ''
|
460
471
|
put_resp = self._put_versioned_obj(req, put_path_info, get_resp)
|
461
472
|
|
462
473
|
self._check_response_error(req, put_resp)
|
463
|
-
|
474
|
+
# successful PUT response should be short
|
475
|
+
drain_and_close(put_resp)
|
464
476
|
|
465
477
|
def handle_obj_versions_put(self, req, versions_cont, api_version,
|
466
478
|
account_name, object_name):
|
@@ -515,7 +527,7 @@ class VersionedWritesContext(WSGIContext):
|
|
515
527
|
marker_req.environ['swift.content_type_overridden'] = True
|
516
528
|
marker_resp = marker_req.get_response(self.app)
|
517
529
|
self._check_response_error(req, marker_resp)
|
518
|
-
|
530
|
+
drain_and_close(marker_resp)
|
519
531
|
|
520
532
|
# successfully copied and created delete marker; safe to delete
|
521
533
|
return self.app
|
@@ -529,7 +541,7 @@ class VersionedWritesContext(WSGIContext):
|
|
529
541
|
|
530
542
|
# if the version isn't there, keep trying with previous version
|
531
543
|
if get_resp.status_int == HTTP_NOT_FOUND:
|
532
|
-
|
544
|
+
drain_and_close(get_resp)
|
533
545
|
return False
|
534
546
|
|
535
547
|
self._check_response_error(req, get_resp)
|
@@ -539,7 +551,7 @@ class VersionedWritesContext(WSGIContext):
|
|
539
551
|
put_resp = self._put_versioned_obj(req, put_path_info, get_resp)
|
540
552
|
|
541
553
|
self._check_response_error(req, put_resp)
|
542
|
-
|
554
|
+
drain_and_close(put_resp)
|
543
555
|
return get_path
|
544
556
|
|
545
557
|
def handle_obj_versions_delete_pop(self, req, versions_cont, api_version,
|
@@ -570,7 +582,7 @@ class VersionedWritesContext(WSGIContext):
|
|
570
582
|
# making any backend requests
|
571
583
|
if 'swift.authorize' in req.environ:
|
572
584
|
container_info = get_container_info(
|
573
|
-
req.environ, self.app)
|
585
|
+
req.environ, self.app, swift_source='VW')
|
574
586
|
req.acl = container_info.get('write_acl')
|
575
587
|
aresp = req.environ['swift.authorize'](req)
|
576
588
|
if aresp:
|
@@ -585,7 +597,7 @@ class VersionedWritesContext(WSGIContext):
|
|
585
597
|
req.environ, path=wsgi_quote(req.path_info), method='HEAD',
|
586
598
|
headers=obj_head_headers, swift_source='VW')
|
587
599
|
hresp = head_req.get_response(self.app)
|
588
|
-
|
600
|
+
drain_and_close(hresp)
|
589
601
|
|
590
602
|
if hresp.status_int != HTTP_NOT_FOUND:
|
591
603
|
self._check_response_error(req, hresp)
|
@@ -601,6 +613,7 @@ class VersionedWritesContext(WSGIContext):
|
|
601
613
|
break
|
602
614
|
obj_to_restore = bytes_to_wsgi(
|
603
615
|
version_to_restore['name'].encode('utf-8'))
|
616
|
+
req.environ['QUERY_STRING'] = ''
|
604
617
|
restored_path = self._restore_data(
|
605
618
|
req, versions_cont, api_version, account_name,
|
606
619
|
container_name, object_name, obj_to_restore)
|
@@ -612,7 +625,7 @@ class VersionedWritesContext(WSGIContext):
|
|
612
625
|
method='DELETE', headers=auth_token_header,
|
613
626
|
swift_source='VW')
|
614
627
|
del_resp = old_del_req.get_response(self.app)
|
615
|
-
|
628
|
+
drain_and_close(del_resp)
|
616
629
|
if del_resp.status_int != HTTP_NOT_FOUND:
|
617
630
|
self._check_response_error(req, del_resp)
|
618
631
|
# else, well, it existed long enough to do the
|
@@ -632,6 +645,7 @@ class VersionedWritesContext(WSGIContext):
|
|
632
645
|
# current object and delete the previous version
|
633
646
|
prev_obj_name = bytes_to_wsgi(
|
634
647
|
previous_version['name'].encode('utf-8'))
|
648
|
+
req.environ['QUERY_STRING'] = ''
|
635
649
|
restored_path = self._restore_data(
|
636
650
|
req, versions_cont, api_version, account_name,
|
637
651
|
container_name, object_name, prev_obj_name)
|
@@ -773,7 +787,7 @@ class VersionedWritesMiddleware(object):
|
|
773
787
|
resp = None
|
774
788
|
is_enabled = config_true_value(allow_versioned_writes)
|
775
789
|
container_info = get_container_info(
|
776
|
-
req.environ, self.app)
|
790
|
+
req.environ, self.app, swift_source='VW')
|
777
791
|
|
778
792
|
# To maintain backwards compatibility, container version
|
779
793
|
# location could be stored as sysmeta or not, need to check both.
|
@@ -856,16 +870,3 @@ class VersionedWritesMiddleware(object):
|
|
856
870
|
return error_response(env, start_response)
|
857
871
|
else:
|
858
872
|
return self.app(env, start_response)
|
859
|
-
|
860
|
-
|
861
|
-
def filter_factory(global_conf, **local_conf):
|
862
|
-
conf = global_conf.copy()
|
863
|
-
conf.update(local_conf)
|
864
|
-
if config_true_value(conf.get('allow_versioned_writes')):
|
865
|
-
register_swift_info('versioned_writes', allowed_flags=(
|
866
|
-
CLIENT_VERSIONS_LOC, CLIENT_HISTORY_LOC))
|
867
|
-
|
868
|
-
def obj_versions_filter(app):
|
869
|
-
return VersionedWritesMiddleware(app, conf)
|
870
|
-
|
871
|
-
return obj_versions_filter
|