opendal 0.1.9 → 0.1.11
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.
- checksums.yaml +4 -4
- data/Cargo.lock +89 -56
- data/Cargo.toml +1 -1
- data/DEPENDENCIES.rust.tsv +55 -41
- data/LICENSE +201 -0
- data/LICENSE-MPL-2.0.txt +373 -0
- data/NOTICE +5 -0
- data/core/CHANGELOG.md +175 -0
- data/core/Cargo.lock +225 -298
- data/core/Cargo.toml +100 -94
- data/core/DEPENDENCIES.rust.tsv +44 -73
- data/core/benches/metadata/README.md +21 -0
- data/core/benches/metadata/main.rs +541 -0
- data/core/benches/vs_fs/Cargo.toml +1 -1
- data/core/benches/vs_s3/Cargo.toml +1 -1
- data/core/core/Cargo.toml +7 -2
- data/core/core/src/blocking/delete.rs +5 -1
- data/core/core/src/blocking/operator.rs +12 -0
- data/core/core/src/blocking/read/std_reader.rs +25 -0
- data/core/core/src/docs/concepts.rs +70 -94
- data/core/core/src/docs/internals/accessor.rs +62 -293
- data/core/core/src/docs/internals/layer.rs +43 -59
- data/core/core/src/docs/internals/mod.rs +21 -23
- data/core/core/src/docs/mod.rs +10 -6
- data/core/core/src/docs/performance/concurrent_write.md +92 -55
- data/core/core/src/docs/performance/http_optimization.md +120 -104
- data/core/core/src/docs/performance/mod.rs +8 -6
- data/core/core/src/docs/rfcs/5485_conditional_reader.md +4 -0
- data/core/core/src/docs/rfcs/7182_restore_api.md +139 -557
- data/core/core/src/docs/rfcs/7945_limited_read.md +210 -0
- data/core/core/src/docs/rfcs/7948_s3_provider_presets.md +254 -0
- data/core/core/src/docs/rfcs/8109_writer_copy_from.md +330 -0
- data/core/core/src/docs/rfcs/8145_conflict_error_kind.md +210 -0
- data/core/core/src/docs/rfcs/8147_write_if_not_changed.md +233 -0
- data/core/core/src/docs/rfcs/8188_compose_api.md +292 -0
- data/core/core/src/docs/rfcs/8194_compact_metadata_and_operation_args.md +444 -0
- data/core/core/src/docs/rfcs/README.md +14 -3
- data/core/core/src/docs/rfcs/mod.rs +46 -22
- data/core/core/src/docs/specs/README.md +34 -0
- data/core/core/src/docs/specs/conditional-operations.md +156 -0
- data/core/core/src/docs/specs/metadata.md +63 -0
- data/core/core/src/docs/specs/mod.rs +26 -0
- data/core/core/src/docs/upgrade.md +114 -1
- data/core/core/src/layers/capability_override.rs +15 -2
- data/core/core/src/layers/complete.rs +347 -43
- data/core/core/src/layers/correctness_check.rs +718 -51
- data/core/core/src/layers/error_context.rs +76 -2
- data/core/core/src/layers/simulate.rs +91 -28
- data/core/core/src/lib.rs +1 -0
- data/core/core/src/raw/accessor.rs +91 -15
- data/core/core/src/raw/enum_utils.rs +7 -0
- data/core/core/src/raw/http_util/header.rs +22 -17
- data/core/core/src/raw/oio/compose/api.rs +92 -0
- data/core/core/src/raw/oio/compose/mod.rs +19 -0
- data/core/core/src/raw/oio/copy/api.rs +3 -3
- data/core/core/src/raw/oio/copy/block_copy.rs +32 -4
- data/core/core/src/raw/oio/copy/multipart_copy.rs +36 -7
- data/core/core/src/raw/oio/entry.rs +48 -22
- data/core/core/src/raw/oio/list/flat_list.rs +1 -1
- data/core/core/src/raw/oio/list/hierarchy_list.rs +3 -2
- data/core/core/src/raw/oio/mod.rs +3 -0
- data/core/core/src/raw/oio/read/position_read.rs +1 -1
- data/core/core/src/raw/oio/write/api.rs +40 -0
- data/core/core/src/raw/oio/write/append_write.rs +4 -4
- data/core/core/src/raw/oio/write/block_write.rs +2 -2
- data/core/core/src/raw/oio/write/multipart_write.rs +181 -48
- data/core/core/src/raw/oio/write/position_write.rs +1 -1
- data/core/core/src/raw/operation.rs +6 -0
- data/core/core/src/raw/ops.rs +1191 -456
- data/core/core/src/raw/rps.rs +11 -0
- data/core/core/src/raw/time.rs +14 -3
- data/core/core/src/services/memory/backend.rs +5 -10
- data/core/core/src/services/memory/lister.rs +4 -4
- data/core/core/src/services/memory/writer.rs +7 -6
- data/core/core/src/types/buffer.rs +102 -12
- data/core/core/src/types/bytes_range.rs +20 -1
- data/core/core/src/types/capability.rs +65 -0
- data/core/core/src/types/compact.rs +329 -0
- data/core/core/src/types/compose/composer.rs +183 -0
- data/core/core/src/types/compose/input.rs +57 -0
- data/core/core/src/types/compose/mod.rs +23 -0
- data/core/core/src/types/context/read.rs +16 -11
- data/core/core/src/types/context/write.rs +150 -2
- data/core/core/src/types/copy.rs +5 -3
- data/core/core/src/types/delete/deleter.rs +20 -12
- data/core/core/src/types/delete/input.rs +22 -64
- data/core/core/src/types/delete/mod.rs +0 -1
- data/core/core/src/types/entry.rs +8 -14
- data/core/core/src/types/error.rs +28 -11
- data/core/core/src/types/metadata.rs +709 -322
- data/core/core/src/types/mod.rs +9 -1
- data/core/core/src/types/operator/operator.rs +278 -29
- data/core/core/src/types/operator/operator_futures.rs +466 -105
- data/core/core/src/types/options.rs +631 -158
- data/core/core/src/types/read/futures_async_reader.rs +663 -50
- data/core/core/src/types/read/reader.rs +23 -5
- data/core/core/src/types/write/futures_async_writer.rs +27 -0
- data/core/core/src/types/write/writer.rs +47 -5
- data/core/http-transports/reqwest/Cargo.toml +1 -1
- data/core/layers/async-backtrace/Cargo.toml +2 -2
- data/core/layers/async-backtrace/src/lib.rs +21 -2
- data/core/layers/await-tree/Cargo.toml +2 -2
- data/core/layers/await-tree/src/lib.rs +25 -2
- data/core/layers/capability-check/Cargo.toml +2 -2
- data/core/layers/capability-check/src/lib.rs +98 -10
- data/core/layers/chaos/Cargo.toml +2 -2
- data/core/layers/chaos/src/lib.rs +18 -3
- data/core/layers/concurrent-limit/Cargo.toml +3 -3
- data/core/layers/concurrent-limit/src/lib.rs +53 -13
- data/core/layers/dtrace/Cargo.toml +2 -2
- data/core/layers/dtrace/src/lib.rs +29 -2
- data/core/layers/fastmetrics/Cargo.toml +3 -3
- data/core/layers/fastrace/Cargo.toml +2 -2
- data/core/layers/fastrace/src/lib.rs +28 -2
- data/core/layers/foyer/Cargo.toml +2 -2
- data/core/layers/foyer/src/full.rs +16 -19
- data/core/layers/foyer/src/lib.rs +67 -14
- data/core/layers/hotpath/Cargo.toml +2 -2
- data/core/layers/hotpath/src/lib.rs +20 -2
- data/core/layers/immutable-index/Cargo.toml +2 -2
- data/core/layers/immutable-index/src/lib.rs +48 -24
- data/core/layers/logging/Cargo.toml +2 -2
- data/core/layers/logging/src/lib.rs +46 -2
- data/core/layers/metrics/Cargo.toml +3 -3
- data/core/layers/mime-guess/Cargo.toml +2 -2
- data/core/layers/mime-guess/src/lib.rs +31 -4
- data/core/layers/observe-metrics-common/Cargo.toml +2 -2
- data/core/layers/observe-metrics-common/src/lib.rs +55 -2
- data/core/layers/otelmetrics/Cargo.toml +3 -3
- data/core/layers/oteltrace/Cargo.toml +2 -2
- data/core/layers/oteltrace/src/lib.rs +27 -2
- data/core/layers/prometheus/Cargo.toml +3 -3
- data/core/layers/prometheus-client/Cargo.toml +3 -3
- data/core/layers/retry/Cargo.toml +4 -4
- data/core/layers/retry/src/lib.rs +76 -19
- data/core/layers/route/Cargo.toml +3 -3
- data/core/layers/route/src/lib.rs +34 -7
- data/core/layers/tail-cut/Cargo.toml +2 -2
- data/core/layers/tail-cut/src/lib.rs +28 -2
- data/core/layers/throttle/Cargo.toml +2 -2
- data/core/layers/throttle/src/lib.rs +19 -2
- data/core/layers/timeout/Cargo.toml +3 -3
- data/core/layers/timeout/src/lib.rs +38 -13
- data/core/layers/tracing/Cargo.toml +2 -2
- data/core/layers/tracing/src/lib.rs +24 -3
- data/core/services/aliyun-drive/Cargo.toml +2 -2
- data/core/services/aliyun-drive/src/backend.rs +34 -24
- data/core/services/aliyun-drive/src/core.rs +143 -54
- data/core/services/aliyun-drive/src/lister.rs +19 -18
- data/core/services/aliyun-drive/src/reader.rs +4 -1
- data/core/services/aliyun-drive/src/writer.rs +3 -3
- data/core/services/alluxio/Cargo.toml +1 -1
- data/core/services/alluxio/src/backend.rs +1 -1
- data/core/services/alluxio/src/core.rs +113 -94
- data/core/services/alluxio/src/reader.rs +7 -3
- data/core/services/alluxio/src/writer.rs +2 -2
- data/core/services/azblob/Cargo.toml +2 -2
- data/core/services/azblob/src/backend.rs +17 -9
- data/core/services/azblob/src/copier.rs +41 -15
- data/core/services/azblob/src/core.rs +372 -135
- data/core/services/azblob/src/deleter.rs +41 -18
- data/core/services/azblob/src/lister.rs +16 -10
- data/core/services/azblob/src/reader.rs +4 -1
- data/core/services/azblob/src/writer.rs +48 -15
- data/core/services/azdls/Cargo.toml +3 -3
- data/core/services/azdls/src/backend.rs +45 -15
- data/core/services/azdls/src/config.rs +4 -1
- data/core/services/azdls/src/core.rs +276 -87
- data/core/services/azdls/src/deleter.rs +13 -4
- data/core/services/azdls/src/lister.rs +18 -12
- data/core/services/azdls/src/reader.rs +6 -2
- data/core/services/azdls/src/writer.rs +44 -23
- data/core/services/azfile/Cargo.toml +2 -2
- data/core/services/azfile/src/backend.rs +24 -8
- data/core/services/azfile/src/core.rs +195 -77
- data/core/services/azfile/src/deleter.rs +8 -1
- data/core/services/azfile/src/lister.rs +20 -14
- data/core/services/azfile/src/reader.rs +5 -2
- data/core/services/azfile/src/writer.rs +27 -15
- data/core/services/azure-common/Cargo.toml +1 -1
- data/core/services/b2/Cargo.toml +2 -2
- data/core/services/b2/src/backend.rs +30 -11
- data/core/services/b2/src/core.rs +134 -120
- data/core/services/b2/src/deleter.rs +1 -1
- data/core/services/b2/src/lister.rs +5 -2
- data/core/services/b2/src/reader.rs +5 -2
- data/core/services/b2/src/writer.rs +29 -12
- data/core/services/cacache/Cargo.toml +1 -1
- data/core/services/cacache/src/backend.rs +4 -5
- data/core/services/cacache/src/reader.rs +4 -1
- data/core/services/cacache/src/writer.rs +6 -2
- data/core/services/cloudflare-kv/Cargo.toml +1 -1
- data/core/services/cloudflare-kv/src/backend.rs +26 -15
- data/core/services/cloudflare-kv/src/config.rs +13 -2
- data/core/services/cloudflare-kv/src/core.rs +62 -56
- data/core/services/cloudflare-kv/src/deleter.rs +12 -3
- data/core/services/cloudflare-kv/src/lister.rs +66 -17
- data/core/services/cloudflare-kv/src/reader.rs +14 -9
- data/core/services/cloudflare-kv/src/writer.rs +10 -7
- data/core/services/compfs/Cargo.toml +1 -1
- data/core/services/compfs/src/backend.rs +11 -7
- data/core/services/compfs/src/lister.rs +7 -7
- data/core/services/compfs/src/writer.rs +1 -1
- data/core/services/cos/Cargo.toml +1 -1
- data/core/services/cos/src/backend.rs +129 -16
- data/core/services/cos/src/core.rs +198 -80
- data/core/services/cos/src/deleter.rs +4 -1
- data/core/services/cos/src/lister.rs +42 -27
- data/core/services/cos/src/reader.rs +6 -2
- data/core/services/cos/src/writer.rs +45 -21
- data/core/services/d1/Cargo.toml +1 -1
- data/core/services/d1/src/backend.rs +6 -5
- data/core/services/d1/src/core.rs +79 -63
- data/core/services/d1/src/reader.rs +4 -1
- data/core/services/d1/src/writer.rs +6 -2
- data/core/services/dashmap/Cargo.toml +1 -1
- data/core/services/dashmap/src/backend.rs +2 -2
- data/core/services/dashmap/src/reader.rs +4 -1
- data/core/services/dashmap/src/writer.rs +11 -8
- data/core/services/dbfs/Cargo.toml +1 -1
- data/core/services/dbfs/src/backend.rs +21 -15
- data/core/services/dbfs/src/core.rs +65 -60
- data/core/services/dbfs/src/deleter.rs +4 -1
- data/core/services/dbfs/src/lister.rs +10 -10
- data/core/services/dbfs/src/writer.rs +6 -3
- data/core/services/dropbox/Cargo.toml +2 -2
- data/core/services/dropbox/src/backend.rs +30 -23
- data/core/services/dropbox/src/core.rs +65 -63
- data/core/services/dropbox/src/deleter.rs +1 -1
- data/core/services/dropbox/src/lister.rs +17 -8
- data/core/services/dropbox/src/reader.rs +4 -1
- data/core/services/dropbox/src/writer.rs +13 -10
- data/core/services/etcd/Cargo.toml +1 -1
- data/core/services/etcd/src/backend.rs +8 -5
- data/core/services/etcd/src/core.rs +5 -11
- data/core/services/etcd/src/lister.rs +6 -1
- data/core/services/etcd/src/reader.rs +4 -1
- data/core/services/etcd/src/writer.rs +6 -3
- data/core/services/foundationdb/Cargo.toml +1 -1
- data/core/services/foundationdb/src/backend.rs +6 -5
- data/core/services/foundationdb/src/reader.rs +4 -1
- data/core/services/foundationdb/src/writer.rs +6 -2
- data/core/services/foyer/Cargo.toml +3 -3
- data/core/services/foyer/src/backend.rs +6 -5
- data/core/services/foyer/src/reader.rs +4 -1
- data/core/services/foyer/src/writer.rs +6 -2
- data/core/services/fs/Cargo.toml +1 -1
- data/core/services/fs/src/backend.rs +4 -3
- data/core/services/fs/src/core.rs +44 -26
- data/core/services/fs/src/lister.rs +9 -6
- data/core/services/fs/src/writer.rs +20 -13
- data/core/services/ftp/Cargo.toml +4 -6
- data/core/services/ftp/src/backend.rs +9 -5
- data/core/services/ftp/src/core.rs +9 -7
- data/core/services/ftp/src/lister.rs +7 -8
- data/core/services/ftp/src/reader.rs +3 -3
- data/core/services/ftp/src/writer.rs +3 -3
- data/core/services/gcs/Cargo.toml +4 -2
- data/core/services/gcs/src/backend.rs +53 -7
- data/core/services/gcs/src/composer.rs +705 -0
- data/core/services/gcs/src/copier.rs +14 -4
- data/core/services/gcs/src/core.rs +828 -124
- data/core/services/gcs/src/deleter.rs +33 -18
- data/core/services/gcs/src/lib.rs +1 -0
- data/core/services/gcs/src/lister.rs +21 -12
- data/core/services/gcs/src/reader.rs +12 -5
- data/core/services/gcs/src/writer.rs +632 -10
- data/core/services/gcs-grpc/Cargo.toml +58 -0
- data/core/services/gcs-grpc/README.md +19 -0
- data/core/services/gcs-grpc/proto/README.md +23 -0
- data/core/services/gcs-grpc/proto/google/storage/v2/storage.proto +171 -0
- data/core/services/gcs-grpc/proto/upstream-descriptor.bin +0 -0
- data/core/services/gcs-grpc/src/backend.rs +449 -0
- data/core/services/gcs-grpc/src/config.rs +116 -0
- data/core/services/gcs-grpc/src/copier.rs +98 -0
- data/core/services/gcs-grpc/src/core.rs +298 -0
- data/core/services/gcs-grpc/src/deleter.rs +65 -0
- data/core/services/gcs-grpc/src/docs.md +19 -0
- data/core/services/gcs-grpc/src/generated/google.storage.v2.rs +541 -0
- data/core/services/gcs-grpc/src/generated/mod.rs +24 -0
- data/core/services/gcs-grpc/src/lib.rs +43 -0
- data/core/services/gcs-grpc/src/lister.rs +125 -0
- data/core/services/gcs-grpc/src/reader.rs +140 -0
- data/core/services/gcs-grpc/src/writer.rs +780 -0
- data/core/services/gdrive/Cargo.toml +2 -2
- data/core/services/gdrive/src/backend.rs +123 -69
- data/core/services/gdrive/src/core.rs +87 -69
- data/core/services/gdrive/src/deleter.rs +8 -2
- data/core/services/gdrive/src/lister.rs +38 -26
- data/core/services/gdrive/src/path_index.rs +2 -2
- data/core/services/gdrive/src/reader.rs +9 -3
- data/core/services/gdrive/src/writer.rs +13 -7
- data/core/services/ghac/Cargo.toml +2 -2
- data/core/services/ghac/src/backend.rs +5 -2
- data/core/services/ghac/src/core.rs +59 -37
- data/core/services/ghac/src/reader.rs +5 -2
- data/core/services/ghac/src/writer.rs +16 -6
- data/core/services/github/Cargo.toml +1 -1
- data/core/services/github/src/backend.rs +16 -8
- data/core/services/github/src/core.rs +88 -76
- data/core/services/github/src/lister.rs +17 -15
- data/core/services/github/src/reader.rs +5 -2
- data/core/services/github/src/writer.rs +12 -6
- data/core/services/goosefs/Cargo.toml +2 -2
- data/core/services/goosefs/src/backend.rs +2 -2
- data/core/services/goosefs/src/core.rs +291 -208
- data/core/services/goosefs/src/docs.md +3 -0
- data/core/services/goosefs/src/lister.rs +2 -3
- data/core/services/goosefs/src/reader.rs +7 -3
- data/core/services/goosefs/src/writer.rs +21 -10
- data/core/services/goosefs/tests/safe_conditional_put.rs +37 -0
- data/core/services/gridfs/Cargo.toml +2 -2
- data/core/services/gridfs/src/backend.rs +12 -8
- data/core/services/gridfs/src/core.rs +1 -1
- data/core/services/gridfs/src/reader.rs +4 -1
- data/core/services/gridfs/src/writer.rs +6 -2
- data/core/services/hdfs/Cargo.toml +1 -1
- data/core/services/hdfs/src/backend.rs +1 -1
- data/core/services/hdfs/src/core.rs +7 -4
- data/core/services/hdfs/src/lister.rs +7 -9
- data/core/services/hdfs/src/writer.rs +5 -1
- data/core/services/hdfs-native/Cargo.toml +1 -1
- data/core/services/hdfs-native/src/backend.rs +1 -1
- data/core/services/hdfs-native/src/core.rs +44 -50
- data/core/services/hdfs-native/src/lister.rs +8 -10
- data/core/services/hdfs-native/src/writer.rs +5 -1
- data/core/services/hf/Cargo.toml +4 -3
- data/core/services/hf/src/backend.rs +4 -3
- data/core/services/hf/src/core.rs +907 -153
- data/core/services/hf/src/lister.rs +16 -6
- data/core/services/hf/src/reader.rs +377 -57
- data/core/services/hf/src/writer.rs +6 -2
- data/core/services/http/Cargo.toml +3 -3
- data/core/services/http/src/backend.rs +8 -6
- data/core/services/http/src/core.rs +57 -35
- data/core/services/http/src/reader.rs +5 -2
- data/core/services/ipfs/Cargo.toml +1 -1
- data/core/services/ipfs/src/backend.rs +20 -9
- data/core/services/ipfs/src/core.rs +43 -34
- data/core/services/ipfs/src/reader.rs +5 -2
- data/core/services/ipmfs/Cargo.toml +1 -1
- data/core/services/ipmfs/src/backend.rs +17 -8
- data/core/services/ipmfs/src/core.rs +66 -60
- data/core/services/ipmfs/src/deleter.rs +5 -2
- data/core/services/ipmfs/src/lister.rs +15 -12
- data/core/services/ipmfs/src/reader.rs +5 -2
- data/core/services/ipmfs/src/writer.rs +6 -3
- data/core/services/koofr/Cargo.toml +2 -2
- data/core/services/koofr/src/backend.rs +46 -17
- data/core/services/koofr/src/core.rs +64 -48
- data/core/services/koofr/src/deleter.rs +4 -1
- data/core/services/koofr/src/lister.rs +11 -10
- data/core/services/koofr/src/reader.rs +5 -2
- data/core/services/koofr/src/writer.rs +13 -7
- data/core/services/lakefs/Cargo.toml +1 -1
- data/core/services/lakefs/src/backend.rs +25 -8
- data/core/services/lakefs/src/core.rs +79 -73
- data/core/services/lakefs/src/deleter.rs +4 -1
- data/core/services/lakefs/src/lister.rs +17 -14
- data/core/services/lakefs/src/reader.rs +5 -2
- data/core/services/lakefs/src/writer.rs +11 -10
- data/core/services/memcached/Cargo.toml +1 -1
- data/core/services/memcached/src/backend.rs +57 -7
- data/core/services/memcached/src/config.rs +13 -2
- data/core/services/memcached/src/core.rs +11 -1
- data/core/services/memcached/src/reader.rs +4 -1
- data/core/services/memcached/src/writer.rs +6 -2
- data/core/services/mini_moka/Cargo.toml +1 -1
- data/core/services/mini_moka/src/backend.rs +8 -8
- data/core/services/mini_moka/src/reader.rs +4 -1
- data/core/services/mini_moka/src/writer.rs +11 -7
- data/core/services/moka/Cargo.toml +1 -1
- data/core/services/moka/src/backend.rs +7 -7
- data/core/services/moka/src/reader.rs +4 -1
- data/core/services/moka/src/writer.rs +10 -6
- data/core/services/mongodb/Cargo.toml +2 -2
- data/core/services/mongodb/src/backend.rs +7 -6
- data/core/services/mongodb/src/core.rs +1 -1
- data/core/services/mongodb/src/reader.rs +4 -1
- data/core/services/mongodb/src/writer.rs +6 -2
- data/core/services/monoiofs/Cargo.toml +2 -2
- data/core/services/monoiofs/src/backend.rs +16 -10
- data/core/services/monoiofs/src/core.rs +8 -9
- data/core/services/monoiofs/src/reader.rs +8 -10
- data/core/services/monoiofs/src/writer.rs +19 -24
- data/core/services/mysql/Cargo.toml +2 -2
- data/core/services/mysql/src/backend.rs +7 -6
- data/core/services/mysql/src/core.rs +1 -1
- data/core/services/mysql/src/lister.rs +7 -3
- data/core/services/mysql/src/reader.rs +4 -1
- data/core/services/mysql/src/writer.rs +6 -2
- data/core/services/obs/Cargo.toml +1 -1
- data/core/services/obs/src/backend.rs +29 -11
- data/core/services/obs/src/core.rs +81 -82
- data/core/services/obs/src/deleter.rs +4 -1
- data/core/services/obs/src/lister.rs +12 -5
- data/core/services/obs/src/reader.rs +5 -2
- data/core/services/obs/src/writer.rs +40 -19
- data/core/services/onedrive/Cargo.toml +2 -2
- data/core/services/onedrive/src/backend.rs +30 -21
- data/core/services/onedrive/src/config.rs +2 -2
- data/core/services/onedrive/src/core.rs +191 -90
- data/core/services/onedrive/src/deleter.rs +5 -2
- data/core/services/onedrive/src/graph_model.rs +10 -51
- data/core/services/onedrive/src/lister.rs +60 -24
- data/core/services/onedrive/src/reader.rs +17 -2
- data/core/services/onedrive/src/writer.rs +26 -15
- data/core/services/opfs/Cargo.toml +1 -1
- data/core/services/opfs/src/backend.rs +6 -13
- data/core/services/opfs/src/core.rs +33 -37
- data/core/services/opfs/src/lister.rs +4 -4
- data/core/services/opfs/src/writer.rs +1 -3
- data/core/services/oss/Cargo.toml +1 -1
- data/core/services/oss/src/backend.rs +40 -8
- data/core/services/oss/src/core.rs +192 -92
- data/core/services/oss/src/deleter.rs +16 -6
- data/core/services/oss/src/lister.rs +43 -27
- data/core/services/oss/src/reader.rs +6 -2
- data/core/services/oss/src/writer.rs +40 -22
- data/core/services/pcloud/Cargo.toml +1 -1
- data/core/services/pcloud/src/backend.rs +40 -6
- data/core/services/pcloud/src/core.rs +80 -66
- data/core/services/pcloud/src/deleter.rs +8 -1
- data/core/services/pcloud/src/lister.rs +4 -1
- data/core/services/pcloud/src/reader.rs +5 -2
- data/core/services/pcloud/src/writer.rs +6 -3
- data/core/services/persy/Cargo.toml +1 -1
- data/core/services/persy/src/backend.rs +6 -5
- data/core/services/persy/src/core.rs +60 -15
- data/core/services/persy/src/reader.rs +4 -1
- data/core/services/persy/src/writer.rs +6 -2
- data/core/services/postgresql/Cargo.toml +2 -2
- data/core/services/postgresql/src/backend.rs +7 -6
- data/core/services/postgresql/src/core.rs +1 -1
- data/core/services/postgresql/src/reader.rs +4 -1
- data/core/services/postgresql/src/writer.rs +6 -2
- data/core/services/redb/Cargo.toml +1 -1
- data/core/services/redb/src/backend.rs +6 -5
- data/core/services/redb/src/reader.rs +4 -1
- data/core/services/redb/src/writer.rs +6 -2
- data/core/services/redis/Cargo.toml +1 -1
- data/core/services/redis/src/backend.rs +18 -8
- data/core/services/redis/src/config.rs +13 -2
- data/core/services/redis/src/reader.rs +8 -4
- data/core/services/redis/src/writer.rs +6 -2
- data/core/services/rocksdb/Cargo.toml +1 -1
- data/core/services/rocksdb/src/backend.rs +6 -5
- data/core/services/rocksdb/src/lister.rs +6 -5
- data/core/services/rocksdb/src/reader.rs +4 -1
- data/core/services/rocksdb/src/writer.rs +6 -2
- data/core/services/s3/Cargo.toml +5 -4
- data/core/services/s3/src/backend.rs +995 -39
- data/core/services/s3/src/compatible_services.md +57 -0
- data/core/services/s3/src/config.rs +16 -0
- data/core/services/s3/src/copier.rs +190 -55
- data/core/services/s3/src/core.rs +299 -190
- data/core/services/s3/src/deleter.rs +26 -7
- data/core/services/s3/src/docs.md +57 -0
- data/core/services/s3/src/lister.rs +55 -36
- data/core/services/s3/src/reader.rs +22 -2
- data/core/services/s3/src/writer.rs +154 -32
- data/core/services/seafile/Cargo.toml +2 -2
- data/core/services/seafile/src/backend.rs +3 -3
- data/core/services/seafile/src/core.rs +105 -79
- data/core/services/seafile/src/lister.rs +11 -8
- data/core/services/seafile/src/reader.rs +5 -2
- data/core/services/seafile/src/writer.rs +6 -3
- data/core/services/sftp/Cargo.toml +1 -1
- data/core/services/sftp/src/backend.rs +19 -4
- data/core/services/sftp/src/core.rs +51 -46
- data/core/services/sftp/src/lister.rs +4 -4
- data/core/services/sftp/src/writer.rs +1 -1
- data/core/services/sled/Cargo.toml +1 -1
- data/core/services/sled/src/backend.rs +6 -5
- data/core/services/sled/src/core.rs +28 -6
- data/core/services/sled/src/lister.rs +6 -5
- data/core/services/sled/src/reader.rs +4 -1
- data/core/services/sled/src/writer.rs +6 -2
- data/core/services/sqlite/Cargo.toml +2 -2
- data/core/services/sqlite/src/backend.rs +12 -7
- data/core/services/sqlite/src/core.rs +3 -3
- data/core/services/sqlite/src/reader.rs +4 -1
- data/core/services/sqlite/src/writer.rs +7 -3
- data/core/services/surrealdb/Cargo.toml +2 -2
- data/core/services/surrealdb/src/backend.rs +7 -6
- data/core/services/surrealdb/src/core.rs +1 -1
- data/core/services/surrealdb/src/reader.rs +4 -1
- data/core/services/surrealdb/src/writer.rs +6 -2
- data/core/services/swift/Cargo.toml +1 -1
- data/core/services/swift/src/backend.rs +38 -8
- data/core/services/swift/src/core.rs +63 -67
- data/core/services/swift/src/deleter.rs +8 -2
- data/core/services/swift/src/lister.rs +11 -8
- data/core/services/swift/src/reader.rs +5 -2
- data/core/services/swift/src/writer.rs +17 -8
- data/core/services/tikv/Cargo.toml +2 -2
- data/core/services/tikv/src/backend.rs +7 -6
- data/core/services/tikv/src/core.rs +31 -14
- data/core/services/tikv/src/reader.rs +4 -1
- data/core/services/tikv/src/writer.rs +6 -2
- data/core/services/tos/Cargo.toml +2 -2
- data/core/services/tos/src/backend.rs +45 -21
- data/core/services/tos/src/copier.rs +44 -17
- data/core/services/tos/src/core.rs +147 -117
- data/core/services/tos/src/deleter.rs +9 -3
- data/core/services/tos/src/docs.md +1 -1
- data/core/services/tos/src/lister.rs +43 -28
- data/core/services/tos/src/reader.rs +5 -2
- data/core/services/tos/src/writer.rs +37 -16
- data/core/services/upyun/Cargo.toml +1 -1
- data/core/services/upyun/src/backend.rs +30 -7
- data/core/services/upyun/src/core.rs +122 -87
- data/core/services/upyun/src/deleter.rs +4 -1
- data/core/services/upyun/src/lister.rs +10 -10
- data/core/services/upyun/src/reader.rs +5 -2
- data/core/services/upyun/src/writer.rs +19 -7
- data/core/services/vercel-artifacts/Cargo.toml +1 -1
- data/core/services/vercel-artifacts/src/backend.rs +6 -3
- data/core/services/vercel-artifacts/src/core.rs +32 -27
- data/core/services/vercel-artifacts/src/reader.rs +5 -2
- data/core/services/vercel-artifacts/src/writer.rs +6 -3
- data/core/services/vercel-blob/Cargo.toml +1 -1
- data/core/services/vercel-blob/src/backend.rs +23 -6
- data/core/services/vercel-blob/src/core.rs +92 -81
- data/core/services/vercel-blob/src/lister.rs +12 -3
- data/core/services/vercel-blob/src/reader.rs +5 -2
- data/core/services/vercel-blob/src/writer.rs +19 -7
- data/core/services/webdav/Cargo.toml +2 -2
- data/core/services/webdav/src/backend.rs +25 -5
- data/core/services/webdav/src/core.rs +116 -59
- data/core/services/webdav/src/deleter.rs +4 -1
- data/core/services/webdav/src/lister.rs +4 -1
- data/core/services/webdav/src/reader.rs +6 -2
- data/core/services/webdav/src/writer.rs +17 -7
- data/core/services/webhdfs/Cargo.toml +2 -2
- data/core/services/webhdfs/src/backend.rs +24 -11
- data/core/services/webhdfs/src/core.rs +99 -98
- data/core/services/webhdfs/src/deleter.rs +5 -2
- data/core/services/webhdfs/src/lister.rs +21 -9
- data/core/services/webhdfs/src/reader.rs +5 -2
- data/core/services/webhdfs/src/writer.rs +49 -14
- data/core/services/yandex-disk/Cargo.toml +1 -1
- data/core/services/yandex-disk/src/backend.rs +28 -6
- data/core/services/yandex-disk/src/core.rs +97 -79
- data/core/services/yandex-disk/src/deleter.rs +4 -1
- data/core/services/yandex-disk/src/lister.rs +25 -9
- data/core/services/yandex-disk/src/reader.rs +5 -2
- data/core/services/yandex-disk/src/writer.rs +6 -3
- data/core/src/lib.rs +5 -0
- data/core/testkit/Cargo.toml +4 -4
- data/core/testkit/src/utils.rs +53 -8
- data/core/tests/behavior/async_compose.rs +297 -0
- data/core/tests/behavior/async_copy.rs +162 -1
- data/core/tests/behavior/async_delete.rs +364 -3
- data/core/tests/behavior/async_read.rs +86 -0
- data/core/tests/behavior/async_restore.rs +162 -0
- data/core/tests/behavior/async_stat.rs +90 -0
- data/core/tests/behavior/async_write.rs +330 -2
- data/core/tests/behavior/main.rs +4 -0
- data/core/upgrade.md +114 -1
- data/src/capability.rs +0 -1
- data/src/io.rs +0 -1
- data/src/lister.rs +0 -1
- data/src/metadata.rs +0 -1
- data/src/operator_info.rs +0 -1
- metadata +44 -2
|
@@ -21,6 +21,7 @@ use std::fmt::Write;
|
|
|
21
21
|
|
|
22
22
|
use base64::Engine;
|
|
23
23
|
use base64::prelude::BASE64_STANDARD;
|
|
24
|
+
use bytes::Buf;
|
|
24
25
|
use bytes::Bytes;
|
|
25
26
|
use constants::X_AMZ_META_PREFIX;
|
|
26
27
|
use crc_fast::CrcAlgorithm;
|
|
@@ -39,8 +40,9 @@ use http::header::IF_MATCH;
|
|
|
39
40
|
use http::header::IF_MODIFIED_SINCE;
|
|
40
41
|
use http::header::IF_NONE_MATCH;
|
|
41
42
|
use http::header::IF_UNMODIFIED_SINCE;
|
|
43
|
+
use quick_xml::de;
|
|
42
44
|
use reqsign_aws_v4::Credential;
|
|
43
|
-
use reqsign_core::{Context, Signer};
|
|
45
|
+
use reqsign_core::{Context, ErrorKind as ReqsignErrorKind, Signer};
|
|
44
46
|
use serde::Deserialize;
|
|
45
47
|
use serde::Serialize;
|
|
46
48
|
|
|
@@ -50,6 +52,10 @@ use opendal_core::*;
|
|
|
50
52
|
pub mod constants {
|
|
51
53
|
pub const X_AMZ_COPY_SOURCE: &str = "x-amz-copy-source";
|
|
52
54
|
pub const X_AMZ_COPY_SOURCE_RANGE: &str = "x-amz-copy-source-range";
|
|
55
|
+
pub const X_AMZ_COPY_SOURCE_IF_MATCH: &str = "x-amz-copy-source-if-match";
|
|
56
|
+
pub const X_AMZ_COPY_SOURCE_IF_NONE_MATCH: &str = "x-amz-copy-source-if-none-match";
|
|
57
|
+
pub const X_AMZ_COPY_SOURCE_IF_MODIFIED_SINCE: &str = "x-amz-copy-source-if-modified-since";
|
|
58
|
+
pub const X_AMZ_COPY_SOURCE_IF_UNMODIFIED_SINCE: &str = "x-amz-copy-source-if-unmodified-since";
|
|
53
59
|
|
|
54
60
|
pub const X_AMZ_SERVER_SIDE_ENCRYPTION: &str = "x-amz-server-side-encryption";
|
|
55
61
|
pub const X_AMZ_SERVER_REQUEST_PAYER: (&str, &str) = ("x-amz-request-payer", "requester");
|
|
@@ -104,17 +110,51 @@ pub struct S3Core {
|
|
|
104
110
|
pub enable_request_payer: bool,
|
|
105
111
|
pub default_acl: Option<String>,
|
|
106
112
|
|
|
107
|
-
pub
|
|
113
|
+
pub(crate) signers: S3Signers,
|
|
108
114
|
pub checksum_algorithm: Option<ChecksumAlgorithm>,
|
|
109
115
|
}
|
|
110
116
|
|
|
117
|
+
pub(crate) enum S3Signers {
|
|
118
|
+
General(Signer<Credential>),
|
|
119
|
+
Express {
|
|
120
|
+
iam: Signer<Credential>,
|
|
121
|
+
session: Signer<Credential>,
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
impl S3Signers {
|
|
126
|
+
pub(crate) fn default(&self) -> &Signer<Credential> {
|
|
127
|
+
match self {
|
|
128
|
+
Self::General(signer)
|
|
129
|
+
| Self::Express {
|
|
130
|
+
session: signer, ..
|
|
131
|
+
} => signer,
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
pub(crate) fn iam(&self) -> &Signer<Credential> {
|
|
136
|
+
match self {
|
|
137
|
+
Self::General(signer) | Self::Express { iam: signer, .. } => signer,
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
fn is_express(&self) -> bool {
|
|
142
|
+
matches!(self, Self::Express { .. })
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
111
146
|
pub(crate) struct S3UploadPartCopyRequest<'a> {
|
|
112
147
|
pub(crate) from: &'a str,
|
|
113
148
|
pub(crate) to: &'a str,
|
|
114
149
|
pub(crate) source_version: Option<&'a str>,
|
|
150
|
+
pub(crate) if_match: Option<&'a str>,
|
|
151
|
+
pub(crate) if_none_match: Option<&'a str>,
|
|
152
|
+
pub(crate) if_modified_since: Option<Timestamp>,
|
|
153
|
+
pub(crate) if_unmodified_since: Option<Timestamp>,
|
|
115
154
|
pub(crate) upload_id: &'a str,
|
|
116
155
|
pub(crate) part_number: usize,
|
|
117
156
|
pub(crate) range: BytesRange,
|
|
157
|
+
pub(crate) operation: Operation,
|
|
118
158
|
}
|
|
119
159
|
|
|
120
160
|
fn format_crc32c_iter(body: Buffer) -> String {
|
|
@@ -136,13 +176,25 @@ impl Debug for S3Core {
|
|
|
136
176
|
}
|
|
137
177
|
|
|
138
178
|
impl S3Core {
|
|
139
|
-
fn
|
|
140
|
-
self.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
179
|
+
fn sign_error(&self, err: reqsign_core::Error) -> Error {
|
|
180
|
+
if !self.signers.is_express() {
|
|
181
|
+
return new_request_sign_error(err.into());
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
let kind = match err.kind() {
|
|
185
|
+
ReqsignErrorKind::CredentialInvalid => ErrorKind::Unexpected,
|
|
186
|
+
ReqsignErrorKind::ConfigInvalid => ErrorKind::ConfigInvalid,
|
|
187
|
+
ReqsignErrorKind::PermissionDenied => ErrorKind::PermissionDenied,
|
|
188
|
+
ReqsignErrorKind::RateLimited => ErrorKind::RateLimited,
|
|
189
|
+
ReqsignErrorKind::RequestInvalid | ReqsignErrorKind::Unexpected => {
|
|
190
|
+
ErrorKind::Unexpected
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
let retryable = err.is_retryable();
|
|
194
|
+
Error::new(kind, "failed to sign S3 Express request")
|
|
195
|
+
.with_operation("S3Core::sign")
|
|
196
|
+
.set_source(err)
|
|
197
|
+
.with_temporary(retryable)
|
|
146
198
|
}
|
|
147
199
|
|
|
148
200
|
pub async fn sign_query<T>(
|
|
@@ -158,10 +210,18 @@ impl S3Core {
|
|
|
158
210
|
// Sign the request with presigned URL
|
|
159
211
|
let (mut parts, body) = req.into_parts();
|
|
160
212
|
|
|
161
|
-
self.
|
|
213
|
+
self.signers
|
|
214
|
+
.iam()
|
|
215
|
+
.clone()
|
|
216
|
+
.with_context(
|
|
217
|
+
Context::new()
|
|
218
|
+
.with_file_read(reqsign_file_read_tokio::TokioFileRead)
|
|
219
|
+
.with_http_send(ctx.http_transport().clone())
|
|
220
|
+
.with_env(reqsign_core::OsEnv),
|
|
221
|
+
)
|
|
162
222
|
.sign(&mut parts, Some(duration))
|
|
163
223
|
.await
|
|
164
|
-
.map_err(|
|
|
224
|
+
.map_err(|err| self.sign_error(err))?;
|
|
165
225
|
|
|
166
226
|
// Always remove host header, let users' client to set it based on HTTP
|
|
167
227
|
// version.
|
|
@@ -178,6 +238,7 @@ impl S3Core {
|
|
|
178
238
|
&self,
|
|
179
239
|
ctx: &OperationContext,
|
|
180
240
|
req: Request<Buffer>,
|
|
241
|
+
signer: &Signer<Credential>,
|
|
181
242
|
) -> Result<Response<Buffer>> {
|
|
182
243
|
if self.skip_signature {
|
|
183
244
|
return ctx.http_transport().send(req).await;
|
|
@@ -185,10 +246,17 @@ impl S3Core {
|
|
|
185
246
|
|
|
186
247
|
let (mut parts, body) = req.into_parts();
|
|
187
248
|
|
|
188
|
-
|
|
249
|
+
signer
|
|
250
|
+
.clone()
|
|
251
|
+
.with_context(
|
|
252
|
+
Context::new()
|
|
253
|
+
.with_file_read(reqsign_file_read_tokio::TokioFileRead)
|
|
254
|
+
.with_http_send(ctx.http_transport().clone())
|
|
255
|
+
.with_env(reqsign_core::OsEnv),
|
|
256
|
+
)
|
|
189
257
|
.sign(&mut parts, None)
|
|
190
258
|
.await
|
|
191
|
-
.map_err(|
|
|
259
|
+
.map_err(|err| self.sign_error(err))?;
|
|
192
260
|
|
|
193
261
|
// Always remove host header, let users' client to set it based on HTTP
|
|
194
262
|
// version.
|
|
@@ -214,10 +282,18 @@ impl S3Core {
|
|
|
214
282
|
|
|
215
283
|
let (mut parts, body) = req.into_parts();
|
|
216
284
|
|
|
217
|
-
self.
|
|
285
|
+
self.signers
|
|
286
|
+
.default()
|
|
287
|
+
.clone()
|
|
288
|
+
.with_context(
|
|
289
|
+
Context::new()
|
|
290
|
+
.with_file_read(reqsign_file_read_tokio::TokioFileRead)
|
|
291
|
+
.with_http_send(ctx.http_transport().clone())
|
|
292
|
+
.with_env(reqsign_core::OsEnv),
|
|
293
|
+
)
|
|
218
294
|
.sign(&mut parts, None)
|
|
219
295
|
.await
|
|
220
|
-
.map_err(|
|
|
296
|
+
.map_err(|err| self.sign_error(err))?;
|
|
221
297
|
|
|
222
298
|
// Always remove host header, let users' client to set it based on HTTP
|
|
223
299
|
// version.
|
|
@@ -643,7 +719,7 @@ impl S3Core {
|
|
|
643
719
|
args: OpStat,
|
|
644
720
|
) -> Result<Response<Buffer>> {
|
|
645
721
|
let req = self.s3_head_object_request(path, args)?;
|
|
646
|
-
self.send(ctx, req).await
|
|
722
|
+
self.send(ctx, req, self.signers.default()).await
|
|
647
723
|
}
|
|
648
724
|
|
|
649
725
|
pub fn s3_delete_object_request(&self, path: &str, args: &OpDelete) -> Result<Request<Buffer>> {
|
|
@@ -667,6 +743,11 @@ impl S3Core {
|
|
|
667
743
|
|
|
668
744
|
let mut req = Request::delete(&url);
|
|
669
745
|
|
|
746
|
+
// Set conditional delete header.
|
|
747
|
+
if let Some(if_match) = args.if_match() {
|
|
748
|
+
req = req.header(IF_MATCH, if_match);
|
|
749
|
+
}
|
|
750
|
+
|
|
670
751
|
// Set request payer header if enabled.
|
|
671
752
|
req = self.insert_request_payer_header(req);
|
|
672
753
|
|
|
@@ -687,7 +768,7 @@ impl S3Core {
|
|
|
687
768
|
args: &OpDelete,
|
|
688
769
|
) -> Result<Response<Buffer>> {
|
|
689
770
|
let req = self.s3_delete_object_request(path, args)?;
|
|
690
|
-
self.send(ctx, req).await
|
|
771
|
+
self.send(ctx, req, self.signers.default()).await
|
|
691
772
|
}
|
|
692
773
|
|
|
693
774
|
pub async fn s3_copy_object(
|
|
@@ -695,13 +776,15 @@ impl S3Core {
|
|
|
695
776
|
ctx: &OperationContext,
|
|
696
777
|
from: &str,
|
|
697
778
|
to: &str,
|
|
779
|
+
source_version: Option<&str>,
|
|
780
|
+
source_if_match: Option<&str>,
|
|
698
781
|
args: &OpCopy,
|
|
699
782
|
) -> Result<Response<Buffer>> {
|
|
700
783
|
let from = build_abs_path(&self.root, from);
|
|
701
784
|
let to = build_abs_path(&self.root, to);
|
|
702
785
|
|
|
703
786
|
let source = format!("{}/{}", self.bucket, percent_encode_path(&from));
|
|
704
|
-
let source = if let Some(version) =
|
|
787
|
+
let source = if let Some(version) = source_version {
|
|
705
788
|
QueryPairsWriter::new(&source)
|
|
706
789
|
.push(
|
|
707
790
|
constants::S3_QUERY_VERSION_ID,
|
|
@@ -722,6 +805,9 @@ impl S3Core {
|
|
|
722
805
|
if let Some(if_match) = args.if_match() {
|
|
723
806
|
req = req.header(IF_MATCH, if_match);
|
|
724
807
|
}
|
|
808
|
+
if let Some(source_if_match) = source_if_match {
|
|
809
|
+
req = req.header(constants::X_AMZ_COPY_SOURCE_IF_MATCH, source_if_match);
|
|
810
|
+
}
|
|
725
811
|
|
|
726
812
|
// Set SSE headers.
|
|
727
813
|
req = self.insert_sse_headers(req, true);
|
|
@@ -776,7 +862,7 @@ impl S3Core {
|
|
|
776
862
|
.body(Buffer::new())
|
|
777
863
|
.map_err(new_request_build_error)?;
|
|
778
864
|
|
|
779
|
-
self.send(ctx, req).await
|
|
865
|
+
self.send(ctx, req, self.signers.iam()).await
|
|
780
866
|
}
|
|
781
867
|
|
|
782
868
|
pub async fn s3_list_objects_v1(
|
|
@@ -816,7 +902,7 @@ impl S3Core {
|
|
|
816
902
|
.body(Buffer::new())
|
|
817
903
|
.map_err(new_request_build_error)?;
|
|
818
904
|
|
|
819
|
-
self.send(ctx, req).await
|
|
905
|
+
self.send(ctx, req, self.signers.default()).await
|
|
820
906
|
}
|
|
821
907
|
|
|
822
908
|
pub async fn s3_list_objects_v2(
|
|
@@ -868,7 +954,7 @@ impl S3Core {
|
|
|
868
954
|
.body(Buffer::new())
|
|
869
955
|
.map_err(new_request_build_error)?;
|
|
870
956
|
|
|
871
|
-
self.send(ctx, req).await
|
|
957
|
+
self.send(ctx, req, self.signers.default()).await
|
|
872
958
|
}
|
|
873
959
|
|
|
874
960
|
pub async fn s3_initiate_multipart_upload(
|
|
@@ -941,7 +1027,7 @@ impl S3Core {
|
|
|
941
1027
|
|
|
942
1028
|
let req = req.body(Buffer::new()).map_err(new_request_build_error)?;
|
|
943
1029
|
|
|
944
|
-
self.send(ctx, req).await
|
|
1030
|
+
self.send(ctx, req, self.signers.default()).await
|
|
945
1031
|
}
|
|
946
1032
|
|
|
947
1033
|
pub async fn s3_initiate_multipart_copy(
|
|
@@ -977,7 +1063,7 @@ impl S3Core {
|
|
|
977
1063
|
.body(Buffer::new())
|
|
978
1064
|
.map_err(new_request_build_error)?;
|
|
979
1065
|
|
|
980
|
-
self.send(ctx, req).await
|
|
1066
|
+
self.send(ctx, req, self.signers.default()).await
|
|
981
1067
|
}
|
|
982
1068
|
|
|
983
1069
|
pub(crate) fn s3_upload_part_copy_request(
|
|
@@ -1009,6 +1095,25 @@ impl S3Core {
|
|
|
1009
1095
|
|
|
1010
1096
|
let mut req = Request::put(&url);
|
|
1011
1097
|
|
|
1098
|
+
if let Some(v) = input.if_match {
|
|
1099
|
+
req = req.header(constants::X_AMZ_COPY_SOURCE_IF_MATCH, v);
|
|
1100
|
+
}
|
|
1101
|
+
if let Some(v) = input.if_none_match {
|
|
1102
|
+
req = req.header(constants::X_AMZ_COPY_SOURCE_IF_NONE_MATCH, v);
|
|
1103
|
+
}
|
|
1104
|
+
if let Some(v) = input.if_modified_since {
|
|
1105
|
+
req = req.header(
|
|
1106
|
+
constants::X_AMZ_COPY_SOURCE_IF_MODIFIED_SINCE,
|
|
1107
|
+
v.format_http_date(),
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
if let Some(v) = input.if_unmodified_since {
|
|
1111
|
+
req = req.header(
|
|
1112
|
+
constants::X_AMZ_COPY_SOURCE_IF_UNMODIFIED_SINCE,
|
|
1113
|
+
v.format_http_date(),
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1012
1117
|
// Set SSE headers.
|
|
1013
1118
|
req = self.insert_sse_headers(req, true);
|
|
1014
1119
|
|
|
@@ -1052,7 +1157,7 @@ impl S3Core {
|
|
|
1052
1157
|
req = self.insert_request_payer_header(req);
|
|
1053
1158
|
|
|
1054
1159
|
let req = req
|
|
1055
|
-
.extension(
|
|
1160
|
+
.extension(input.operation)
|
|
1056
1161
|
.extension(ServiceOperation("UploadPartCopy"))
|
|
1057
1162
|
.header(constants::X_AMZ_COPY_SOURCE, source)
|
|
1058
1163
|
.header(constants::X_AMZ_COPY_SOURCE_RANGE, input.range.to_header())
|
|
@@ -1156,7 +1261,7 @@ impl S3Core {
|
|
|
1156
1261
|
.body(Buffer::from(Bytes::from(content)))
|
|
1157
1262
|
.map_err(new_request_build_error)?;
|
|
1158
1263
|
|
|
1159
|
-
self.send(ctx, req).await
|
|
1264
|
+
self.send(ctx, req, self.signers.default()).await
|
|
1160
1265
|
}
|
|
1161
1266
|
|
|
1162
1267
|
pub async fn s3_complete_multipart_copy(
|
|
@@ -1204,7 +1309,7 @@ impl S3Core {
|
|
|
1204
1309
|
.body(Buffer::from(Bytes::from(content)))
|
|
1205
1310
|
.map_err(new_request_build_error)?;
|
|
1206
1311
|
|
|
1207
|
-
self.send(ctx, req).await
|
|
1312
|
+
self.send(ctx, req, self.signers.default()).await
|
|
1208
1313
|
}
|
|
1209
1314
|
|
|
1210
1315
|
/// Abort an on-going multipart upload.
|
|
@@ -1235,7 +1340,7 @@ impl S3Core {
|
|
|
1235
1340
|
.body(Buffer::new())
|
|
1236
1341
|
.map_err(new_request_build_error)?;
|
|
1237
1342
|
|
|
1238
|
-
self.send(ctx, req).await
|
|
1343
|
+
self.send(ctx, req, self.signers.default()).await
|
|
1239
1344
|
}
|
|
1240
1345
|
|
|
1241
1346
|
/// Abort an on-going multipart copy.
|
|
@@ -1265,7 +1370,7 @@ impl S3Core {
|
|
|
1265
1370
|
.body(Buffer::new())
|
|
1266
1371
|
.map_err(new_request_build_error)?;
|
|
1267
1372
|
|
|
1268
|
-
self.send(ctx, req).await
|
|
1373
|
+
self.send(ctx, req, self.signers.default()).await
|
|
1269
1374
|
}
|
|
1270
1375
|
|
|
1271
1376
|
pub async fn s3_delete_objects(
|
|
@@ -1284,6 +1389,7 @@ impl S3Core {
|
|
|
1284
1389
|
.map(|(path, op)| DeleteObjectsRequestObject {
|
|
1285
1390
|
key: build_abs_path(&self.root, path),
|
|
1286
1391
|
version_id: op.version().map(|v| v.to_owned()),
|
|
1392
|
+
etag: op.if_match().map(|v| v.to_owned()),
|
|
1287
1393
|
})
|
|
1288
1394
|
.collect(),
|
|
1289
1395
|
})
|
|
@@ -1308,7 +1414,7 @@ impl S3Core {
|
|
|
1308
1414
|
.body(Buffer::from(Bytes::from(content)))
|
|
1309
1415
|
.map_err(new_request_build_error)?;
|
|
1310
1416
|
|
|
1311
|
-
self.send(ctx, req).await
|
|
1417
|
+
self.send(ctx, req, self.signers.default()).await
|
|
1312
1418
|
}
|
|
1313
1419
|
|
|
1314
1420
|
pub async fn s3_list_object_versions(
|
|
@@ -1359,7 +1465,7 @@ impl S3Core {
|
|
|
1359
1465
|
.body(Buffer::new())
|
|
1360
1466
|
.map_err(new_request_build_error)?;
|
|
1361
1467
|
|
|
1362
|
-
self.send(ctx, req).await
|
|
1468
|
+
self.send(ctx, req, self.signers.default()).await
|
|
1363
1469
|
}
|
|
1364
1470
|
}
|
|
1365
1471
|
|
|
@@ -1459,6 +1565,8 @@ pub struct DeleteObjectsRequestObject {
|
|
|
1459
1565
|
pub key: String,
|
|
1460
1566
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
1461
1567
|
pub version_id: Option<String>,
|
|
1568
|
+
#[serde(rename = "ETag", skip_serializing_if = "Option::is_none")]
|
|
1569
|
+
pub etag: Option<String>,
|
|
1462
1570
|
}
|
|
1463
1571
|
|
|
1464
1572
|
/// Result of DeleteObjects.
|
|
@@ -1721,10 +1829,17 @@ mod tests {
|
|
|
1721
1829
|
DeleteObjectsRequestObject {
|
|
1722
1830
|
key: "sample1.txt".to_string(),
|
|
1723
1831
|
version_id: None,
|
|
1832
|
+
etag: None,
|
|
1724
1833
|
},
|
|
1725
1834
|
DeleteObjectsRequestObject {
|
|
1726
1835
|
key: "sample2.txt".to_string(),
|
|
1727
1836
|
version_id: Some("11111".to_owned()),
|
|
1837
|
+
etag: None,
|
|
1838
|
+
},
|
|
1839
|
+
DeleteObjectsRequestObject {
|
|
1840
|
+
key: "sample3.txt".to_string(),
|
|
1841
|
+
version_id: None,
|
|
1842
|
+
etag: Some("\"d41d8cd98f00b204e9800998ecf8427e\"".to_owned()),
|
|
1728
1843
|
},
|
|
1729
1844
|
],
|
|
1730
1845
|
};
|
|
@@ -1742,6 +1857,10 @@ mod tests {
|
|
|
1742
1857
|
<Key>sample2.txt</Key>
|
|
1743
1858
|
<VersionId>11111</VersionId>
|
|
1744
1859
|
</Object>
|
|
1860
|
+
<Object>
|
|
1861
|
+
<Key>sample3.txt</Key>
|
|
1862
|
+
<ETag>"d41d8cd98f00b204e9800998ecf8427e"</ETag>
|
|
1863
|
+
</Object>
|
|
1745
1864
|
</Delete>"#
|
|
1746
1865
|
// Cleanup space and new line
|
|
1747
1866
|
.replace([' ', '\n'], "")
|
|
@@ -2019,183 +2138,173 @@ mod tests {
|
|
|
2019
2138
|
}
|
|
2020
2139
|
}
|
|
2021
2140
|
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
/// S3Error is the error returned by s3 service.
|
|
2033
|
-
#[derive(Default, Debug, Deserialize, PartialEq, Eq)]
|
|
2034
|
-
#[serde(default, rename_all = "PascalCase")]
|
|
2035
|
-
pub(crate) struct S3Error {
|
|
2036
|
-
pub code: String,
|
|
2037
|
-
pub message: String,
|
|
2038
|
-
pub resource: String,
|
|
2039
|
-
pub request_id: String,
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
/// Parse error response into Error.
|
|
2043
|
-
pub(crate) fn parse_error(resp: Response<Buffer>) -> Error {
|
|
2044
|
-
let (parts, body) = resp.into_parts();
|
|
2045
|
-
let bs = body.to_bytes();
|
|
2046
|
-
|
|
2047
|
-
let (mut kind, mut retryable) = match parts.status.as_u16() {
|
|
2048
|
-
403 => (ErrorKind::PermissionDenied, false),
|
|
2049
|
-
404 => (ErrorKind::NotFound, false),
|
|
2050
|
-
304 | 412 => (ErrorKind::ConditionNotMatch, false),
|
|
2051
|
-
// 409 Conflict can be returned e.g. when PutObject with conditions.
|
|
2052
|
-
// In this case the AWS docs say to retry.
|
|
2053
|
-
409 => (ErrorKind::ConditionNotMatch, true),
|
|
2054
|
-
// Service like R2 could return 499 error with a message like:
|
|
2055
|
-
// Client Disconnect, we should retry it.
|
|
2056
|
-
499 => (ErrorKind::Unexpected, true),
|
|
2057
|
-
500 | 502 | 503 | 504 => (ErrorKind::Unexpected, true),
|
|
2058
|
-
429 => (ErrorKind::RateLimited, true),
|
|
2059
|
-
_ => (ErrorKind::Unexpected, false),
|
|
2060
|
-
};
|
|
2141
|
+
/// S3Error is the error returned by s3 service.
|
|
2142
|
+
#[derive(Default, Debug, Deserialize, PartialEq, Eq)]
|
|
2143
|
+
#[serde(default, rename_all = "PascalCase")]
|
|
2144
|
+
pub struct S3Error {
|
|
2145
|
+
pub code: String,
|
|
2146
|
+
pub message: String,
|
|
2147
|
+
pub resource: String,
|
|
2148
|
+
pub request_id: String,
|
|
2149
|
+
}
|
|
2061
2150
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2151
|
+
#[derive(Clone, Copy, Debug)]
|
|
2152
|
+
pub struct ErrorContext {
|
|
2153
|
+
service_operation: ServiceOperation,
|
|
2154
|
+
caller_condition: bool,
|
|
2155
|
+
source_if_match: bool,
|
|
2156
|
+
}
|
|
2066
2157
|
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2158
|
+
impl ErrorContext {
|
|
2159
|
+
pub const fn new(service_operation: ServiceOperation) -> Self {
|
|
2160
|
+
Self {
|
|
2161
|
+
service_operation,
|
|
2162
|
+
caller_condition: false,
|
|
2163
|
+
source_if_match: false,
|
|
2070
2164
|
}
|
|
2165
|
+
}
|
|
2071
2166
|
|
|
2072
|
-
|
|
2167
|
+
pub const fn with_caller_condition(mut self, caller_condition: bool) -> Self {
|
|
2168
|
+
self.caller_condition = caller_condition;
|
|
2169
|
+
self
|
|
2170
|
+
}
|
|
2073
2171
|
|
|
2074
|
-
|
|
2172
|
+
pub const fn with_source_if_match(mut self, source_if_match: bool) -> Self {
|
|
2173
|
+
self.source_if_match = source_if_match;
|
|
2174
|
+
self
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2075
2177
|
|
|
2076
|
-
|
|
2077
|
-
|
|
2178
|
+
/// Parse error response into Error.
|
|
2179
|
+
pub fn parse_error(ctx: ErrorContext, resp: Response<Buffer>) -> Error {
|
|
2180
|
+
let (parts, body) = resp.into_parts();
|
|
2181
|
+
let bs = body.to_bytes();
|
|
2182
|
+
|
|
2183
|
+
let (mut kind, mut retryable) = match parts.status.as_u16() {
|
|
2184
|
+
403 => (ErrorKind::PermissionDenied, false),
|
|
2185
|
+
404 => (ErrorKind::NotFound, false),
|
|
2186
|
+
304 | 412 if ctx.caller_condition => (ErrorKind::ConditionNotMatch, false),
|
|
2187
|
+
// Service like R2 could return 499 error with a message like:
|
|
2188
|
+
// Client Disconnect, we should retry it.
|
|
2189
|
+
499 => (ErrorKind::Unexpected, true),
|
|
2190
|
+
500 | 502 | 503 | 504 => (ErrorKind::Unexpected, true),
|
|
2191
|
+
429 => (ErrorKind::RateLimited, true),
|
|
2192
|
+
_ => (ErrorKind::Unexpected, false),
|
|
2193
|
+
};
|
|
2194
|
+
|
|
2195
|
+
let body_content = bs.chunk();
|
|
2196
|
+
let (message, s3_err) = de::from_reader::<_, S3Error>(body_content.reader())
|
|
2197
|
+
.map(|s3_err| (format!("{s3_err:?}"), Some(s3_err)))
|
|
2198
|
+
.unwrap_or_else(|_| (String::from_utf8_lossy(&bs).into_owned(), None));
|
|
2199
|
+
|
|
2200
|
+
if let Some(s3_err) = s3_err
|
|
2201
|
+
&& !s3_err.code.is_empty()
|
|
2202
|
+
{
|
|
2203
|
+
if let Some(classification) = parse_s3_error_code(ctx, s3_err.code.as_str()) {
|
|
2204
|
+
(kind, retryable) = classification;
|
|
2205
|
+
} else if matches!(parts.status.as_u16(), 409 | 412) {
|
|
2206
|
+
(kind, retryable) = (ErrorKind::Unexpected, false);
|
|
2078
2207
|
}
|
|
2079
|
-
|
|
2080
|
-
err
|
|
2081
2208
|
}
|
|
2082
2209
|
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
let (kind, retryable) =
|
|
2086
|
-
parse_s3_error_code(s3_error.code.as_str()).unwrap_or((ErrorKind::Unexpected, false));
|
|
2087
|
-
let mut err = Error::new(kind, format!("{s3_error:?}"));
|
|
2088
|
-
|
|
2089
|
-
err = with_error_response_context(err, parts);
|
|
2210
|
+
let mut err =
|
|
2211
|
+
Error::new(kind, message).with_context("service_operation", ctx.service_operation.0);
|
|
2090
2212
|
|
|
2091
|
-
|
|
2092
|
-
err = err.set_temporary();
|
|
2093
|
-
}
|
|
2213
|
+
err = with_error_response_context(err, parts);
|
|
2094
2214
|
|
|
2095
|
-
|
|
2215
|
+
if retryable {
|
|
2216
|
+
err = err.set_temporary();
|
|
2096
2217
|
}
|
|
2097
2218
|
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2219
|
+
err
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
/// Returns the `Error kind` of this code and whether the error is retryable.
|
|
2223
|
+
/// All possible error code: <https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList>
|
|
2224
|
+
pub fn parse_s3_error_code(ctx: ErrorContext, code: &str) -> Option<(ErrorKind, bool)> {
|
|
2225
|
+
match code {
|
|
2226
|
+
// > The specified bucket does not exist.
|
|
2227
|
+
//
|
|
2228
|
+
// Although the status code is 404, NoSuchBucket is
|
|
2229
|
+
// a config invalid error, and it's not retryable from OpenDAL.
|
|
2230
|
+
"NoSuchBucket" => Some((ErrorKind::ConfigInvalid, false)),
|
|
2231
|
+
// S3 Express can return 200 OK with an embedded NoSuchKey error for
|
|
2232
|
+
// CopyObject. Classify the error code explicitly because the HTTP
|
|
2233
|
+
// status alone cannot preserve the NotFound semantics in this case.
|
|
2234
|
+
"NoSuchKey" => Some((ErrorKind::NotFound, false)),
|
|
2235
|
+
// > Your socket connection to the server was not read from
|
|
2236
|
+
// > or written to within the timeout period."
|
|
2237
|
+
//
|
|
2238
|
+
// It's Ok for us to retry it again.
|
|
2239
|
+
"RequestTimeout" => Some((ErrorKind::Unexpected, true)),
|
|
2240
|
+
// > An internal error occurred. Try again.
|
|
2241
|
+
"InternalError" => Some((ErrorKind::Unexpected, true)),
|
|
2242
|
+
// > A conflicting conditional operation is currently in progress
|
|
2243
|
+
// > against this resource. Try again.
|
|
2244
|
+
"OperationAborted" => Some((ErrorKind::Conflict, true)),
|
|
2245
|
+
// > Please reduce your request rate.
|
|
2246
|
+
//
|
|
2247
|
+
// It's Ok to retry since later on the request rate may get reduced.
|
|
2248
|
+
"SlowDown" => Some((ErrorKind::RateLimited, true)),
|
|
2249
|
+
// > Service is unable to handle request.
|
|
2250
|
+
//
|
|
2251
|
+
// ServiceUnavailable is considered a retryable error because it typically
|
|
2252
|
+
// indicates a temporary issue with the service or server, such as high load,
|
|
2253
|
+
// maintenance, or an internal problem.
|
|
2254
|
+
"ServiceUnavailable" => Some((ErrorKind::Unexpected, true)),
|
|
2255
|
+
// > Too Many Requests - rate limit exceeded.
|
|
2256
|
+
//
|
|
2257
|
+
// It's Ok to retry since later on the request rate may get reduced.
|
|
2258
|
+
"TooManyRequests" => Some((ErrorKind::RateLimited, true)),
|
|
2259
|
+
// > Compatibility with Volcengine TOS
|
|
2260
|
+
//
|
|
2261
|
+
// TOS returns following error codes along with 429 status code, while both
|
|
2262
|
+
// of them indicate rate limit exceeded.
|
|
2263
|
+
// See https://www.volcengine.com/docs/6349/74874 for more details.
|
|
2264
|
+
"ExceedAccountQPSLimit"
|
|
2265
|
+
| "ExceedAccountRateLimit"
|
|
2266
|
+
| "ExceedBucketQPSLimit"
|
|
2267
|
+
| "ExceedBucketRateLimit" => Some((ErrorKind::RateLimited, true)),
|
|
2268
|
+
"InvalidRange" => Some((ErrorKind::RangeNotSatisfied, false)),
|
|
2269
|
+
"PreconditionFailed" | "412 Precondition Failed" if ctx.caller_condition => {
|
|
2270
|
+
Some((ErrorKind::ConditionNotMatch, false))
|
|
2271
|
+
}
|
|
2272
|
+
"PreconditionFailed" | "412 Precondition Failed" if ctx.source_if_match => {
|
|
2273
|
+
Some((ErrorKind::Conflict, false))
|
|
2274
|
+
}
|
|
2275
|
+
"ConditionalRequestConflict" => Some((
|
|
2276
|
+
ErrorKind::Conflict,
|
|
2277
|
+
ctx.service_operation == ServiceOperation("PutObject"),
|
|
2278
|
+
)),
|
|
2279
|
+
_ => None,
|
|
2143
2280
|
}
|
|
2281
|
+
}
|
|
2144
2282
|
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
/// Error response example is from https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
|
|
2150
|
-
#[test]
|
|
2151
|
-
fn test_parse_error() {
|
|
2152
|
-
let bs = bytes::Bytes::from(
|
|
2153
|
-
r#"
|
|
2154
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2155
|
-
<Error>
|
|
2156
|
-
<Code>NoSuchKey</Code>
|
|
2157
|
-
<Message>The resource you requested does not exist</Message>
|
|
2158
|
-
<Resource>/mybucket/myfoto.jpg</Resource>
|
|
2159
|
-
<RequestId>4442587FB7D0A2F9</RequestId>
|
|
2160
|
-
</Error>
|
|
2161
|
-
"#,
|
|
2162
|
-
);
|
|
2283
|
+
#[cfg(test)]
|
|
2284
|
+
mod error_tests {
|
|
2285
|
+
use super::*;
|
|
2163
2286
|
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
#[test]
|
|
2174
|
-
fn test_parse_error_from_unrelated_input() {
|
|
2175
|
-
let bs = bytes::Bytes::from(
|
|
2176
|
-
r#"
|
|
2177
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2178
|
-
<CompleteMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
2179
|
-
<Location>http://Example-Bucket.s3.ap-southeast-1.amazonaws.com/Example-Object</Location>
|
|
2180
|
-
<Bucket>Example-Bucket</Bucket>
|
|
2181
|
-
<Key>Example-Object</Key>
|
|
2182
|
-
<ETag>"3858f62230ac3c915f300c664312c11f-9"</ETag>
|
|
2183
|
-
</CompleteMultipartUploadResult>
|
|
2184
|
-
"#,
|
|
2185
|
-
);
|
|
2287
|
+
#[test]
|
|
2288
|
+
fn precondition_failed_uses_operation_context() {
|
|
2289
|
+
let caller_condition = ErrorContext::new(ServiceOperation("CopyObject"))
|
|
2290
|
+
.with_caller_condition(true)
|
|
2291
|
+
.with_source_if_match(true);
|
|
2292
|
+
assert_eq!(
|
|
2293
|
+
parse_s3_error_code(caller_condition, "PreconditionFailed"),
|
|
2294
|
+
Some((ErrorKind::ConditionNotMatch, false))
|
|
2295
|
+
);
|
|
2186
2296
|
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2297
|
+
let internal_source_condition =
|
|
2298
|
+
ErrorContext::new(ServiceOperation("CopyObject")).with_source_if_match(true);
|
|
2299
|
+
assert_eq!(
|
|
2300
|
+
parse_s3_error_code(internal_source_condition, "PreconditionFailed"),
|
|
2301
|
+
Some((ErrorKind::Conflict, false))
|
|
2302
|
+
);
|
|
2190
2303
|
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
);
|
|
2197
|
-
}
|
|
2304
|
+
let no_condition = ErrorContext::new(ServiceOperation("CopyObject"));
|
|
2305
|
+
assert_eq!(
|
|
2306
|
+
parse_s3_error_code(no_condition, "PreconditionFailed"),
|
|
2307
|
+
None
|
|
2308
|
+
);
|
|
2198
2309
|
}
|
|
2199
2310
|
}
|
|
2200
|
-
|
|
2201
|
-
pub(super) use error::*;
|