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
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
- Proposal Name: `compact_metadata_and_operation_args`
|
|
2
|
+
- Start Date: 2026-08-29
|
|
3
|
+
- RFC PR: [apache/opendal#8194](https://github.com/apache/opendal/pull/8194)
|
|
4
|
+
- Tracking Issue: [apache/opendal#0000](https://github.com/apache/opendal/issues/0000)
|
|
5
|
+
|
|
6
|
+
# Summary
|
|
7
|
+
|
|
8
|
+
Represent `Metadata` and raw operation arguments with a private, copy-on-write
|
|
9
|
+
value block. `Metadata` keeps its required content length and optional timestamp
|
|
10
|
+
inline. Raw arguments place scalars according to their access and allocation
|
|
11
|
+
profile: `OpRead` packs its optional content-length hint, while `OpList` keeps
|
|
12
|
+
its limit inline. Optional strings, user metadata, listed paths, and raw
|
|
13
|
+
conditional timestamps use one immutable, exactly sized allocation per owner.
|
|
14
|
+
Each `Metadata` remains independently owned, and existing public `*Options`
|
|
15
|
+
remain the sole mutable operation-construction types.
|
|
16
|
+
|
|
17
|
+
On the measured 64-bit target, the prototype reduces `Metadata` from 264
|
|
18
|
+
to 40 bytes, `OpRead` from 256 to 16 bytes, `OpWrite` from 256 to 32 bytes, and
|
|
19
|
+
the other affected raw operations to 16-64 bytes. Clones share the block.
|
|
20
|
+
Empty metadata and metadata containing only inline scalars allocate nothing.
|
|
21
|
+
|
|
22
|
+
# Motivation
|
|
23
|
+
|
|
24
|
+
`Metadata` is returned by stat, read, and list operations and is often retained
|
|
25
|
+
in application caches, indexes, or work queues. It must remain independently
|
|
26
|
+
owned because a single listed entry can outlive its producing page. This makes
|
|
27
|
+
per-value size, allocation count, and clone cost part of the steady-state cost
|
|
28
|
+
of common OpenDAL workloads rather than temporary response-decoding overhead.
|
|
29
|
+
|
|
30
|
+
The current representation reserves one `Option<String>` slot for every known
|
|
31
|
+
string field even when most fields are absent. On the measured 64-bit target,
|
|
32
|
+
an empty `Metadata` occupies 264 bytes; 10,000 list results therefore reserve
|
|
33
|
+
about 2.5 MiB for metadata structs before paths, string payloads, collection
|
|
34
|
+
capacity, and allocator overhead. Each populated string allocates separately.
|
|
35
|
+
User metadata adds `HashMap` buckets and two independently allocated strings per
|
|
36
|
+
pair. Derived `Clone` repeats every populated string, bucket array, key, and
|
|
37
|
+
value, so cloning cost grows with the logical payload instead of remaining
|
|
38
|
+
constant.
|
|
39
|
+
|
|
40
|
+
Raw operation arguments have the same shape after their public options have
|
|
41
|
+
already been finalized. A measured `OpRead` occupies 256 bytes, owns each
|
|
42
|
+
condition or override string separately, and is retained by read contexts and
|
|
43
|
+
cloned when opening or splitting reads. Other raw operations repeat the same
|
|
44
|
+
pattern. Existing metadata mutation is concentrated in service response
|
|
45
|
+
assembly and normalization; downstream code primarily reads and retains the
|
|
46
|
+
completed value. Separating mutable construction from immutable results matches
|
|
47
|
+
this lifecycle. Compact immutable blocks make clone cost constant and reduce
|
|
48
|
+
resident memory and allocator traffic for large listings, concurrent reads,
|
|
49
|
+
retries, and downstream metadata retention.
|
|
50
|
+
|
|
51
|
+
Release-mode benchmarks ran on an Apple M4 Max with 128 GiB RAM using Rust
|
|
52
|
+
1.97.0. They compare the prototype types with the previous field-for-field
|
|
53
|
+
representations under the same allocator and benchmark process. Retaining
|
|
54
|
+
10,000 independently owned values produced these peak live-heap measurements.
|
|
55
|
+
Times are the median of three benchmark invocations and include constructing
|
|
56
|
+
the complete batch:
|
|
57
|
+
|
|
58
|
+
| Retained batch | Previous heap | Compact heap | Heap change | Previous time | Compact time |
|
|
59
|
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
|
60
|
+
| List: length, ETag, version | 3.480 MB | 1.520 MB | -56.3% | 256.5 us | 597.5 us |
|
|
61
|
+
| List entries including paths | 3.980 MB | 1.760 MB | -55.8% | 528.5 us | 1.517 ms |
|
|
62
|
+
| Stat: seven strings | 4.540 MB | 2.720 MB | -40.1% | 712.0 us | 1.618 ms |
|
|
63
|
+
| Stat plus eight user pairs | 14.070 MB | 4.721 MB | -66.4% | 2.945 ms | 7.208 ms |
|
|
64
|
+
|
|
65
|
+
The retained allocation count falls from 20,001 to 10,003 for the list metadata
|
|
66
|
+
profile, 30,001 to 10,004 for list entries including their paths, 70,001 to
|
|
67
|
+
10,008 for stat, and 240,001 to 10,025 with user metadata. Packing is therefore
|
|
68
|
+
2.3-2.9 times slower during initial construction, while removing 40-66% of
|
|
69
|
+
retained heap and 50-96% of retained allocations.
|
|
70
|
+
An empty build changes from 13.17 ns to 24.64 ns. Cloning an empty value and
|
|
71
|
+
adding its first ETag changes from 35.36 ns to 53.38 ns because the compact form
|
|
72
|
+
creates its value block at that point.
|
|
73
|
+
|
|
74
|
+
Clone performance measures the lifecycle after construction:
|
|
75
|
+
|
|
76
|
+
| Operation | Previous median | Compact median | Change |
|
|
77
|
+
| --- | ---: | ---: | ---: |
|
|
78
|
+
| Clone list metadata | 39.12 ns | 2.13 ns | 18.4x faster |
|
|
79
|
+
| Clone stat metadata | 118.0 ns | 1.99 ns | 59.3x faster |
|
|
80
|
+
| Clone metadata with user pairs | 451.5 ns | 1.89 ns | 239.4x faster |
|
|
81
|
+
| Clone then replace stat ETag | 141.4 ns | 86.58 ns | 38.8% faster |
|
|
82
|
+
| Clone then replace user-metadata ETag | 484.6 ns | 83.97 ns | 82.7% faster |
|
|
83
|
+
| Read list version | 0.74 ns | 1.55 ns | 2.1x slower |
|
|
84
|
+
| Read user-metadata version | 0.73 ns | 1.52 ns | 2.1x slower |
|
|
85
|
+
|
|
86
|
+
Raw-operation measurements show the same exchange. Freezing populated
|
|
87
|
+
`ReadOptions` into `OpRead` changes from 62.34 ns to about 110 ns, while cloning
|
|
88
|
+
the compact result takes about 1.56 ns and no allocation instead of roughly 145
|
|
89
|
+
ns and eight allocations. For `OpWrite`, freezing changes from 186.9 ns to 437.8 ns,
|
|
90
|
+
while cloning changes from 480.0 ns and 25 allocations to 1.87 ns and no
|
|
91
|
+
allocation. Reading a packed read version takes 1.54 ns versus 1.63 ns from the
|
|
92
|
+
previous representation. Decoding a packed hint together with the version adds
|
|
93
|
+
about 0.8-1.4 ns compared with keeping the hint inline. Looking up one of eight
|
|
94
|
+
write user metadata entries takes 6.39 ns versus 10.82 ns. Direct final-block
|
|
95
|
+
encoding keeps lookup cheap and avoids temporary nested value blocks during the
|
|
96
|
+
mutable-to-immutable freeze.
|
|
97
|
+
|
|
98
|
+
The smaller owned condition also reduces public option layouts that embed
|
|
99
|
+
`Option<Metadata>`: `DeleteOptions` falls from 392 to 176 bytes (-55.1%),
|
|
100
|
+
`WriteOptions` from 536 to 320 bytes (-40.3%), and `CopyOptions` from 432 to 216
|
|
101
|
+
bytes (-50.0%).
|
|
102
|
+
|
|
103
|
+
Integer placement was measured separately because placing every integer in the
|
|
104
|
+
value block minimizes the carrier size but can introduce an allocation for a
|
|
105
|
+
value that previously needed none. The benchmark compares equivalent private
|
|
106
|
+
layouts and reports peak live heap while retaining 10,000 values:
|
|
107
|
+
|
|
108
|
+
| Metadata profile | Length and timestamp inline | Timestamp packed | All scalars packed |
|
|
109
|
+
| --- | ---: | ---: | ---: |
|
|
110
|
+
| Length only | 400 KB | 320 KB | 640 KB |
|
|
111
|
+
| Length and timestamp | 400 KB | 720 KB | 720 KB |
|
|
112
|
+
| Length, timestamp, ETag, version | 1.520 MB | 1.600 MB | 1.600 MB |
|
|
113
|
+
| Full stat | 2.720 MB | 2.800 MB | 2.800 MB |
|
|
114
|
+
|
|
115
|
+
The inline layout constructs those batches in 90.2 us, 97.3 us, 561.8 us, and
|
|
116
|
+
1.540 ms respectively. Packing the timestamp takes 159.3 us, 213.7 us, 596.1
|
|
117
|
+
us, and 1.645 ms; packing every scalar takes 206.5 us, 252.1 us, 601.9 us, and
|
|
118
|
+
1.678 ms. A scalar-only inline batch performs one allocation for the containing
|
|
119
|
+
`Vec`; either packed scalar layout performs 10,001 allocations when its packed
|
|
120
|
+
field is present. `Metadata` therefore keeps `content_length` and
|
|
121
|
+
`last_modified` inline. Their direct getters also avoid value-block decoding.
|
|
122
|
+
|
|
123
|
+
`OpRead::content_length_hint` has a different lifecycle. Packing it reduces
|
|
124
|
+
every `OpRead` from 32 to 16 bytes and reuses the value block whenever another
|
|
125
|
+
packed read option is present:
|
|
126
|
+
|
|
127
|
+
| Retained `OpRead` profile | Inline hint heap / time | Packed hint heap / time |
|
|
128
|
+
| --- | ---: | ---: |
|
|
129
|
+
| Empty | 320 KB / 127.5 us | 160 KB / 191.5 us |
|
|
130
|
+
| Hint only | 320 KB / 125.0 us | 560 KB / 243.6 us |
|
|
131
|
+
| Version only | 1.040 MB / 409.5 us | 880 KB / 401.6 us |
|
|
132
|
+
| Version and hint | 1.040 MB / 396.6 us | 960 KB / 422.1 us |
|
|
133
|
+
| All read options | 3.040 MB / 2.134 ms | 2.960 MB / 1.770 ms |
|
|
134
|
+
|
|
135
|
+
Single-value lowering remains 11.3 ns for an empty value and changes from
|
|
136
|
+
106.0 ns to 109.9 ns for all read options. The isolated hint profile changes
|
|
137
|
+
from 11.5 ns with no allocation to 22.5 ns with one allocation. This RFC accepts
|
|
138
|
+
that narrow case because the hint is optional, consumers read it during
|
|
139
|
+
operation setup rather than each streamed read, and the 16-byte reduction
|
|
140
|
+
applies to every retained or cloned `OpRead`.
|
|
141
|
+
|
|
142
|
+
Packing `OpList::limit` would reduce the carrier from 32 to 24 bytes, but a
|
|
143
|
+
limit-only batch would grow from 320 KB to 640 KB and slow from 26.58 us to
|
|
144
|
+
121.3 us. A batch containing both `start_after` and `limit` would grow from 800
|
|
145
|
+
KB to 880 KB and slow from 290.7 us to 317.6 us. `OpList` therefore keeps
|
|
146
|
+
`limit` inline.
|
|
147
|
+
|
|
148
|
+
# Guide-level explanation
|
|
149
|
+
|
|
150
|
+
`Metadata` remains an owned, immutable value with existing scalar and string
|
|
151
|
+
getters:
|
|
152
|
+
|
|
153
|
+
```rust
|
|
154
|
+
let metadata = op.stat("path/to/file").await?;
|
|
155
|
+
let size = metadata.content_length();
|
|
156
|
+
let etag = metadata.etag();
|
|
157
|
+
let cloned = metadata.clone();
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The clone can outlive its producer. Callers construct metadata with
|
|
161
|
+
`MetadataBuilder` and consume existing metadata into a builder when they need a
|
|
162
|
+
modified value:
|
|
163
|
+
|
|
164
|
+
```rust
|
|
165
|
+
let mut builder = Metadata::builder(EntryMode::FILE);
|
|
166
|
+
builder.content_length(size).etag(etag);
|
|
167
|
+
let metadata = builder.build();
|
|
168
|
+
|
|
169
|
+
let mut builder = metadata.into_builder();
|
|
170
|
+
builder.content_length(actual_size);
|
|
171
|
+
let metadata = builder.build();
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
User metadata is exposed through a borrowed view:
|
|
175
|
+
|
|
176
|
+
```rust
|
|
177
|
+
if let Some(attributes) = metadata.user_metadata() {
|
|
178
|
+
println!("{:?}", attributes.get("owner"));
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The view supports lookup and iteration without materializing a map. Callers use
|
|
183
|
+
`IntoIterator` directly and collect into the collection required by their
|
|
184
|
+
boundary.
|
|
185
|
+
|
|
186
|
+
# Reference-level explanation
|
|
187
|
+
|
|
188
|
+
## Public API
|
|
189
|
+
|
|
190
|
+
`MetadataBuilder` is the only public construction and modification surface for
|
|
191
|
+
metadata. `Metadata` exposes no `new`, `Default`, `set_*`, or `with_*` API:
|
|
192
|
+
|
|
193
|
+
```rust
|
|
194
|
+
impl Metadata {
|
|
195
|
+
pub fn builder(mode: EntryMode) -> MetadataBuilder;
|
|
196
|
+
pub fn into_builder(self) -> MetadataBuilder;
|
|
197
|
+
pub fn user_metadata(&self) -> Option<UserMetadata<'_>>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
pub struct MetadataBuilder {
|
|
201
|
+
// Private mutable construction state.
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
impl MetadataBuilder {
|
|
205
|
+
pub fn mode(&mut self, value: EntryMode) -> &mut Self;
|
|
206
|
+
pub fn content_length(&mut self, value: u64) -> &mut Self;
|
|
207
|
+
pub fn etag(&mut self, value: impl Into<String>) -> &mut Self;
|
|
208
|
+
pub fn user_metadata(
|
|
209
|
+
&mut self,
|
|
210
|
+
value: impl IntoIterator<Item = (String, String)>,
|
|
211
|
+
) -> &mut Self;
|
|
212
|
+
pub fn build(self) -> Metadata;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
impl OpWrite {
|
|
216
|
+
pub fn user_metadata(&self) -> Option<UserMetadata<'_>>;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
#[derive(Clone, Copy)]
|
|
220
|
+
pub struct UserMetadata<'a> {
|
|
221
|
+
// Private view into an immutable value block.
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
impl<'a> UserMetadata<'a> {
|
|
225
|
+
pub fn get(&self, key: &str) -> Option<&'a str>;
|
|
226
|
+
pub fn len(&self) -> usize;
|
|
227
|
+
pub fn is_empty(&self) -> bool;
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The builder provides the same setter shape for every other logical metadata
|
|
232
|
+
field.
|
|
233
|
+
|
|
234
|
+
`UserMetadata` and `&UserMetadata` implement
|
|
235
|
+
`IntoIterator<Item = (&str, &str)>`. Callers can collect borrowed pairs
|
|
236
|
+
directly; boundaries that require ownership map the pairs to owned strings and
|
|
237
|
+
collect them. The builder accepts any owned string pairs and preserves the
|
|
238
|
+
distinction between an explicitly empty collection and an absent value.
|
|
239
|
+
Existing metadata getters, `Lister`, `Operator`, public operation options, and
|
|
240
|
+
raw operation getters retain their signatures and ownership semantics.
|
|
241
|
+
|
|
242
|
+
## Representation and ownership
|
|
243
|
+
|
|
244
|
+
The conceptual metadata representation is:
|
|
245
|
+
|
|
246
|
+
```rust
|
|
247
|
+
pub struct Metadata {
|
|
248
|
+
header: MetadataHeader,
|
|
249
|
+
values: CompactValues,
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
struct CompactValues(Option<Arc<[u8]>>);
|
|
253
|
+
|
|
254
|
+
struct MetadataHeader {
|
|
255
|
+
content_length: u64,
|
|
256
|
+
last_modified_seconds: i64,
|
|
257
|
+
last_modified_nanoseconds: u32,
|
|
258
|
+
flags: MetadataFlags,
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
#[repr(transparent)]
|
|
262
|
+
struct MetadataFlags(u16);
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
`MetadataFlags` encodes mode, scalar presence, deletion state, the three states
|
|
266
|
+
of `is_current`, and whether user metadata was supplied. Separate seconds and
|
|
267
|
+
nanoseconds preserve the range and precision of the existing `last_modified`
|
|
268
|
+
field.
|
|
269
|
+
|
|
270
|
+
On 64-bit targets, `MetadataHeader` is 24 bytes. `Arc<[u8]>` is a 16-byte fat
|
|
271
|
+
pointer, and `Option<Arc<[u8]>>` has the same size because `None` uses the null
|
|
272
|
+
pointer niche. `Metadata` is therefore 40 bytes. These are implementation
|
|
273
|
+
targets, not a stable ABI.
|
|
274
|
+
|
|
275
|
+
Each owner defines a closed internal `FieldId` set. A value block contains a
|
|
276
|
+
presence bitmap, a `u16` end offset for each present field, and payloads ordered
|
|
277
|
+
by `FieldId`; absent fields consume no offset slot. Known fields use bitmap and
|
|
278
|
+
offset arithmetic rather than hashing. User metadata follows them as sorted
|
|
279
|
+
key/value ranges and uses binary search, giving deterministic iteration and
|
|
280
|
+
order-independent equality.
|
|
281
|
+
|
|
282
|
+
Fields may contain UTF-8 strings or fixed-width scalar encodings. Private typed
|
|
283
|
+
helpers encode and decode scalars in little-endian byte order and require the
|
|
284
|
+
exact width for the field type. Integer type alone does not determine field
|
|
285
|
+
placement; each owner chooses whether a scalar remains inline or becomes a
|
|
286
|
+
typed value-block field.
|
|
287
|
+
|
|
288
|
+
String ranges enter the block only from Rust `str` or `String` values. Internal
|
|
289
|
+
decoding accepts blocks produced by the same encoders, so getters preserve this
|
|
290
|
+
UTF-8 invariant without validating the same bytes on every access.
|
|
291
|
+
|
|
292
|
+
Every encoded `CompactValues` block, including its bitmap, offsets, and entry
|
|
293
|
+
path when present, is limited to `u16::MAX` bytes. A builder panics before
|
|
294
|
+
encoding a larger block. There is no fallback representation.
|
|
295
|
+
|
|
296
|
+
For listed entries, the entry path occupies a private range in the same value
|
|
297
|
+
record. Retaining one entry can retain its own path but never its siblings.
|
|
298
|
+
Equality, debug output, bindings, and serialization use logical getters and do
|
|
299
|
+
not expose the byte representation as an ABI or wire format.
|
|
300
|
+
|
|
301
|
+
## Construction and transformation
|
|
302
|
+
|
|
303
|
+
A fresh `MetadataBuilder` stores the inline header and mutable values until
|
|
304
|
+
`build` encodes one exact block. `Metadata::into_builder` moves the existing
|
|
305
|
+
header and `CompactValues` into the builder without eagerly decoding or copying
|
|
306
|
+
the block. Header-only changes reuse the existing block. Packed-field changes
|
|
307
|
+
are recorded by the builder and encoded together once at `build`, leaving
|
|
308
|
+
clones of the original metadata unchanged. User metadata and nested conditional
|
|
309
|
+
metadata write directly into the final block instead of allocating intermediate
|
|
310
|
+
encoded buffers.
|
|
311
|
+
|
|
312
|
+
An `Entry` stores its path in the same block as its metadata.
|
|
313
|
+
`Entry::into_parts` retains its return type and materializes the returned path
|
|
314
|
+
`String`. `oio::Entry::metadata_mut` is removed; code that needs a modified
|
|
315
|
+
entry consumes its metadata into a builder and replaces the completed value.
|
|
316
|
+
|
|
317
|
+
## Raw operation arguments
|
|
318
|
+
|
|
319
|
+
Public `ReadOptions`, `StatOptions`, `WriteOptions`, `DeleteOptions`,
|
|
320
|
+
`CopyOptions`, `ListOptions`, and `RestoreOptions` remain ordinary owned,
|
|
321
|
+
mutable structs. Converting an options value into its raw `Op*` is a structural
|
|
322
|
+
freeze: every option is moved into the corresponding raw argument without
|
|
323
|
+
capability-dependent rewriting. The conversion does not accept or inspect
|
|
324
|
+
`Capability` and does not interpret conditional values.
|
|
325
|
+
|
|
326
|
+
For example:
|
|
327
|
+
|
|
328
|
+
```rust
|
|
329
|
+
pub struct OpRead {
|
|
330
|
+
values: CompactValues,
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
`ReadField::ContentLengthHint` stores the hint as a fixed-width `u64` entry.
|
|
335
|
+
Existing optional fields use typed value entries; strings use UTF-8 and
|
|
336
|
+
fixed-width values use canonical little-endian encoding. A default `OpRead`
|
|
337
|
+
does not allocate. A hint-only value allocates one exact block; a hint combined
|
|
338
|
+
with another packed option shares that option's allocation. The measured
|
|
339
|
+
previous and proposed 64-bit sizes are:
|
|
340
|
+
|
|
341
|
+
| Type | Previous | Compact |
|
|
342
|
+
| --- | ---: | ---: |
|
|
343
|
+
| `OpRead` | 256 bytes | 16 bytes |
|
|
344
|
+
| `OpStat` | 240 bytes | 16 bytes |
|
|
345
|
+
| `OpWrite` | 256 bytes | 32 bytes |
|
|
346
|
+
| `OpDelete` | 128 bytes | 24 bytes |
|
|
347
|
+
| `OpCopy` | 168 bytes | 64 bytes |
|
|
348
|
+
| `OpList` | 48 bytes | 32 bytes |
|
|
349
|
+
| `OpRestore` | 32 bytes | 24 bytes |
|
|
350
|
+
|
|
351
|
+
`OpWrite` packs user metadata using the same sorted key/value representation as
|
|
352
|
+
`Metadata`. `OpReader`, `OpWriter`, and `OpCopy` retain their scalar tuning
|
|
353
|
+
fields, `OpList` retains its inline limit, and `OpRename` retains its one-byte
|
|
354
|
+
representation. The `OpCopy` measurement reflects the current single raw
|
|
355
|
+
argument that also owns copy concurrency, chunk size, and source length hint.
|
|
356
|
+
|
|
357
|
+
Raw `Op*` values expose getters plus `Clone`, `Default`, and `new` for empty
|
|
358
|
+
arguments, but no public `with_*` methods. Options-to-raw conversion encodes all
|
|
359
|
+
fields in one pass. `WriteOptions`, `DeleteOptions`, and `CopyOptions` preserve
|
|
360
|
+
the complete logical `if_not_changed` value in the corresponding raw arguments;
|
|
361
|
+
its fields are packed into the operation's value block rather than lowered to a
|
|
362
|
+
selected ETag or version condition. How a service evaluates the condition is
|
|
363
|
+
outside this representation RFC.
|
|
364
|
+
|
|
365
|
+
## Required content length
|
|
366
|
+
|
|
367
|
+
Every file `Metadata` returned by an `Operator` has an explicit content length
|
|
368
|
+
for the complete object. Directory metadata reports zero. A private presence
|
|
369
|
+
bit distinguishes an explicit zero from a missing value during assembly. A
|
|
370
|
+
completion layer may fill a missing value; publishing file metadata without one
|
|
371
|
+
returns `Unexpected`. The guarantee applies at the `Operator` response boundary.
|
|
372
|
+
|
|
373
|
+
# Compatibility and migration
|
|
374
|
+
|
|
375
|
+
`Metadata::user_metadata` and `OpWrite::user_metadata` break callers that name
|
|
376
|
+
or clone the returned `HashMap`; lookup and length checks retain the same shape,
|
|
377
|
+
while iteration uses `IntoIterator` instead of an `iter` method. Bindings
|
|
378
|
+
materialize their maps by collecting owned pairs at the boundary.
|
|
379
|
+
|
|
380
|
+
Metadata construction migrates from `Metadata::new`, `Default`, `set_*`, and
|
|
381
|
+
`with_*` to `Metadata::builder`; modifying an owned value uses
|
|
382
|
+
`Metadata::into_builder`. Raw callers migrate chained `Op*::with_*` construction
|
|
383
|
+
to the corresponding public `*Options` and structural conversion. Empty raw
|
|
384
|
+
arguments continue to use `new` or `Default`. Encoded value blocks larger than
|
|
385
|
+
`u16::MAX`, including codec overhead, now panic. Raw list batching, scheduling,
|
|
386
|
+
retry, serialization, and conditional-operation semantics remain unchanged.
|
|
387
|
+
|
|
388
|
+
# Drawbacks
|
|
389
|
+
|
|
390
|
+
Variable-field lookup performs bitmap and offset arithmetic instead of
|
|
391
|
+
dereferencing an `Option<String>`. A one-field transformation requires a
|
|
392
|
+
builder round trip, and removing direct mutation is a source-breaking API
|
|
393
|
+
change. Clone and drop perform an atomic reference-count operation when a block
|
|
394
|
+
exists. The private codec must uphold offset bounds and UTF-8 validity and is
|
|
395
|
+
less convenient to inspect in a debugger. A hint-only `OpRead` adds one
|
|
396
|
+
allocation and fixed-width decoding to save 16 bytes in every `OpRead`.
|
|
397
|
+
|
|
398
|
+
# Rationale and alternatives
|
|
399
|
+
|
|
400
|
+
Direct `Option<Box<str>>` fields remove string capacity but keep a pointer and
|
|
401
|
+
length for every absent field and retain one allocation per populated field. A
|
|
402
|
+
map adds bucket overhead and hashing for a closed field set. A page arena lets
|
|
403
|
+
one retained entry keep all siblings alive. A separate `Arc<Record>` and boxed
|
|
404
|
+
payload needs two allocations. The inline metadata header preserves direct
|
|
405
|
+
access to required or frequently read scalars and prevents scalar-only metadata
|
|
406
|
+
from allocating.
|
|
407
|
+
|
|
408
|
+
Scalar placement follows the measured lifecycle of its owner. The required
|
|
409
|
+
metadata content length and optional metadata timestamp stay inline because
|
|
410
|
+
packing either creates per-value allocations in scalar-only profiles.
|
|
411
|
+
`OpList::limit` stays inline because its standalone profile regresses both heap
|
|
412
|
+
and construction time. The setup-only, optional
|
|
413
|
+
`OpRead::content_length_hint` uses an existing typed value entry because halving
|
|
414
|
+
every `OpRead` outweighs the isolated hint-only allocation. This field-specific
|
|
415
|
+
rule retains a single compact codec without adding a second container or a
|
|
416
|
+
public scalar-storage abstraction.
|
|
417
|
+
|
|
418
|
+
Compacting the public `*Options` types would move block rebuilding into the
|
|
419
|
+
short-lived configuration path. Public options already express the mutable
|
|
420
|
+
construction state, so freezing them once at their existing conversion
|
|
421
|
+
boundary keeps mutation cheap without another builder or pending-options type.
|
|
422
|
+
|
|
423
|
+
# Prior art
|
|
424
|
+
|
|
425
|
+
Cloudflare's [DNS cache memory optimization][cloudflare-dns-cache] applies the
|
|
426
|
+
same principles to immutable Rust cache entries: remove unused capacity, pack
|
|
427
|
+
variable data into one exactly sized byte buffer, reuse scratch storage during
|
|
428
|
+
construction, and measure allocation and resident memory. OpenDAL keeps hot
|
|
429
|
+
scalars decoded and uses an independent entry allocation because downstream
|
|
430
|
+
users retain metadata outside list operations.
|
|
431
|
+
|
|
432
|
+
[cloudflare-dns-cache]: https://blog.cloudflare.com/dns-cache-memory-optimization-1111/
|
|
433
|
+
|
|
434
|
+
# Validation
|
|
435
|
+
|
|
436
|
+
The implementation must include layout tests for all sizes in this RFC on
|
|
437
|
+
supported 64-bit targets. Contract tests cover getters, equality, debug output,
|
|
438
|
+
timestamp range and precision, builder round trips, transformation after clone,
|
|
439
|
+
empty-versus-absent user metadata, field-for-field options conversion,
|
|
440
|
+
dispatch-time conditional lowering, and required file content length. Boundary
|
|
441
|
+
tests prove that a `u16::MAX`-byte block succeeds and the next byte panics before
|
|
442
|
+
encoding. Prototype benchmarks cover construction, retained heap, lookup, clone,
|
|
443
|
+
builder transformation, raw operations, and scalar placement. The implementation
|
|
444
|
+
must check in equivalent benchmarks with the optimized types.
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
# RFCs - OpenDAL
|
|
1
|
+
# RFCs - OpenDAL Design History
|
|
2
2
|
|
|
3
|
-
RFCs power OpenDAL's development
|
|
3
|
+
RFCs power OpenDAL's development and preserve the history behind substantial
|
|
4
|
+
design decisions.
|
|
5
|
+
|
|
6
|
+
An accepted RFC is an immutable historical document. It records the proposal
|
|
7
|
+
that reached consensus at the time of acceptance, but it is not the current
|
|
8
|
+
contract. [OpenDAL specifications][crate::docs::specs] define the living
|
|
9
|
+
contracts implemented by current releases.
|
|
4
10
|
|
|
5
11
|
The "RFC" (request for comments) process is intended to provide a consistent and controlled path for changes to OpenDAL (such as new features) so that all stakeholders can be confident about the direction of the project.
|
|
6
12
|
|
|
@@ -56,7 +62,12 @@ Each accepted RFC is associated with an issue in the OpenDAL repository, which t
|
|
|
56
62
|
If you are interested in implementing an RFC but are unsure if someone else is already working on it,
|
|
57
63
|
feel free to inquire by leaving a comment on the associated issue.
|
|
58
64
|
|
|
65
|
+
After implementation, update or add a specification when the RFC establishes
|
|
66
|
+
portable user-visible behavior. Later contract changes update the specification
|
|
67
|
+
and, when substantial, require a new RFC. They do not rewrite the accepted RFC.
|
|
68
|
+
|
|
59
69
|
## Some useful tips
|
|
60
70
|
|
|
61
71
|
- The author of an RFC may not be the same one as the implementer. Therefore, when submitting an RFC, it is advisable to include sufficient information.
|
|
62
|
-
-
|
|
72
|
+
- Do not modify an accepted RFC. Correct the current contract in a specification
|
|
73
|
+
and create a new RFC when the change is substantial.
|
|
@@ -21,29 +21,13 @@
|
|
|
21
21
|
#[doc = include_str!("0000_example.md")]
|
|
22
22
|
pub mod rfc_0000_example {}
|
|
23
23
|
|
|
24
|
-
///
|
|
25
|
-
#[doc = include_str!("
|
|
26
|
-
pub mod
|
|
24
|
+
/// Compact metadata and operation arguments
|
|
25
|
+
#[doc = include_str!("8194_compact_metadata_and_operation_args.md")]
|
|
26
|
+
pub mod rfc_8194_compact_metadata_and_operation_args {}
|
|
27
27
|
|
|
28
|
-
///
|
|
29
|
-
#[doc = include_str!("
|
|
30
|
-
pub mod
|
|
31
|
-
|
|
32
|
-
/// Simplify Stateful Operation Factory
|
|
33
|
-
#[doc = include_str!("7744_simplify_stateful_operation_factory.md")]
|
|
34
|
-
pub mod rfc_7744_simplify_stateful_operation_factory {}
|
|
35
|
-
|
|
36
|
-
/// Operator Composition
|
|
37
|
-
#[doc = include_str!("7740_operator_composition.md")]
|
|
38
|
-
pub mod rfc_7740_operator_composition {}
|
|
39
|
-
|
|
40
|
-
/// Capability API
|
|
41
|
-
#[doc = include_str!("7700_capability_api.md")]
|
|
42
|
-
pub mod rfc_7700_capability_api {}
|
|
43
|
-
|
|
44
|
-
/// Move Read Range To Reader
|
|
45
|
-
#[doc = include_str!("7660_move_read_range_to_reader.md")]
|
|
46
|
-
pub mod rfc_7660_move_read_range_to_reader {}
|
|
28
|
+
/// Write if not changed
|
|
29
|
+
#[doc = include_str!("8147_write_if_not_changed.md")]
|
|
30
|
+
pub mod rfc_8147_write_if_not_changed {}
|
|
47
31
|
|
|
48
32
|
/// Object native API
|
|
49
33
|
#[doc = include_str!("0041_object_native_api.md")]
|
|
@@ -328,3 +312,43 @@ pub mod rfc_7130_route_layer {}
|
|
|
328
312
|
/// Copier API
|
|
329
313
|
#[doc = include_str!("7519_copier_api.md")]
|
|
330
314
|
pub mod rfc_7519_copier_api {}
|
|
315
|
+
|
|
316
|
+
/// Move Read Range To Reader
|
|
317
|
+
#[doc = include_str!("7660_move_read_range_to_reader.md")]
|
|
318
|
+
pub mod rfc_7660_move_read_range_to_reader {}
|
|
319
|
+
|
|
320
|
+
/// Capability API
|
|
321
|
+
#[doc = include_str!("7700_capability_api.md")]
|
|
322
|
+
pub mod rfc_7700_capability_api {}
|
|
323
|
+
|
|
324
|
+
/// Operator Composition
|
|
325
|
+
#[doc = include_str!("7740_operator_composition.md")]
|
|
326
|
+
pub mod rfc_7740_operator_composition {}
|
|
327
|
+
|
|
328
|
+
/// Simplify Stateful Operation Factory
|
|
329
|
+
#[doc = include_str!("7744_simplify_stateful_operation_factory.md")]
|
|
330
|
+
pub mod rfc_7744_simplify_stateful_operation_factory {}
|
|
331
|
+
|
|
332
|
+
/// HTTP Transporter
|
|
333
|
+
#[doc = include_str!("7749_http_transporter.md")]
|
|
334
|
+
pub mod rfc_7749_http_transporter {}
|
|
335
|
+
|
|
336
|
+
/// Rename If Not Exists
|
|
337
|
+
#[doc = include_str!("7818_rename_if_not_exists.md")]
|
|
338
|
+
pub mod rfc_7818_rename_if_not_exists {}
|
|
339
|
+
|
|
340
|
+
/// Limited Read
|
|
341
|
+
#[doc = include_str!("7945_limited_read.md")]
|
|
342
|
+
pub mod rfc_7945_limited_read {}
|
|
343
|
+
|
|
344
|
+
/// S3 Provider Presets
|
|
345
|
+
#[doc = include_str!("7948_s3_provider_presets.md")]
|
|
346
|
+
pub mod rfc_7948_s3_provider_presets {}
|
|
347
|
+
|
|
348
|
+
/// Writer Copy From
|
|
349
|
+
#[doc = include_str!("8109_writer_copy_from.md")]
|
|
350
|
+
pub mod rfc_8109_writer_copy_from {}
|
|
351
|
+
|
|
352
|
+
/// Conflict Error Kind
|
|
353
|
+
#[doc = include_str!("8145_conflict_error_kind.md")]
|
|
354
|
+
pub mod rfc_8145_conflict_error_kind {}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# OpenDAL Specifications
|
|
2
|
+
|
|
3
|
+
Specifications define the portable behavior OpenDAL promises: the observable
|
|
4
|
+
contracts that hold across every supporting service. They are living
|
|
5
|
+
documents; implementations, API documentation, and behavior tests must remain
|
|
6
|
+
consistent with them as OpenDAL evolves. Some promises apply only when the
|
|
7
|
+
service advertises the corresponding capability, and an unsupported request
|
|
8
|
+
fails with an explicit error. Behavior outside a specification's promises is
|
|
9
|
+
outside the portable contract, and callers must not rely on it holding across
|
|
10
|
+
services.
|
|
11
|
+
|
|
12
|
+
Specifications state the contract. Behavior tests under `core/tests/behavior`
|
|
13
|
+
provide executable conformance coverage for the specified contracts. Public
|
|
14
|
+
API documentation explains the observable behavior, capability requirements,
|
|
15
|
+
parameter meaning, and relevant errors at the API site, then links to the
|
|
16
|
+
specification for the complete cross-operation contract.
|
|
17
|
+
|
|
18
|
+
Accepted RFCs are immutable historical documents. They record the design that
|
|
19
|
+
reached consensus, including its original motivation and trade-offs.
|
|
20
|
+
Specifications describe the current contract, even when later implementation
|
|
21
|
+
work or a newer RFC changes the accepted design.
|
|
22
|
+
|
|
23
|
+
Editorial corrections and changes that codify already implemented behavior use
|
|
24
|
+
the normal pull request process and include evidence for that behavior. A
|
|
25
|
+
substantial contract change requires a new RFC. The resulting implementation,
|
|
26
|
+
behavior tests, API documentation, and specification change land together.
|
|
27
|
+
|
|
28
|
+
## Active specifications
|
|
29
|
+
|
|
30
|
+
- [Conditional operations](https://opendal.apache.org/docs/specifications/conditional-operations/)
|
|
31
|
+
define portable predicate, error, and atomicity semantics, including the
|
|
32
|
+
behavior when the file does not exist.
|
|
33
|
+
- [Metadata](https://opendal.apache.org/docs/specifications/metadata/) defines
|
|
34
|
+
owned metadata, compact construction limits, and result completion semantics.
|