opendal 0.1.6.pre.rc.1
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 +7 -0
- data/.standard.yml +20 -0
- data/.tool-versions +1 -0
- data/.yardopts +1 -0
- data/Cargo.toml +65 -0
- data/DEPENDENCIES.md +9 -0
- data/DEPENDENCIES.rust.tsv +277 -0
- data/Gemfile +35 -0
- data/README.md +159 -0
- data/Rakefile +149 -0
- data/build.rs +22 -0
- data/core/CHANGELOG.md +4929 -0
- data/core/CONTRIBUTING.md +61 -0
- data/core/Cargo.lock +10259 -0
- data/core/Cargo.toml +437 -0
- data/core/DEPENDENCIES.md +3 -0
- data/core/DEPENDENCIES.rust.tsv +185 -0
- data/core/LICENSE +201 -0
- data/core/README.md +228 -0
- data/core/benches/README.md +18 -0
- data/core/benches/ops/README.md +26 -0
- data/core/benches/ops/main.rs +25 -0
- data/core/benches/ops/read.rs +100 -0
- data/core/benches/ops/utils.rs +59 -0
- data/core/benches/ops/write.rs +106 -0
- data/core/benches/types/README.md +9 -0
- data/core/benches/types/buffer.rs +114 -0
- data/core/benches/types/main.rs +23 -0
- data/core/benches/types/tasks.rs +64 -0
- data/core/benches/vs_fs/Cargo.toml +32 -0
- data/core/benches/vs_fs/README.md +35 -0
- data/core/benches/vs_fs/src/main.rs +83 -0
- data/core/benches/vs_s3/Cargo.toml +38 -0
- data/core/benches/vs_s3/README.md +55 -0
- data/core/benches/vs_s3/src/main.rs +123 -0
- data/core/edge/README.md +3 -0
- data/core/edge/file_write_on_full_disk/Cargo.toml +31 -0
- data/core/edge/file_write_on_full_disk/README.md +14 -0
- data/core/edge/file_write_on_full_disk/src/main.rs +43 -0
- data/core/edge/s3_aws_assume_role_with_web_identity/Cargo.toml +30 -0
- data/core/edge/s3_aws_assume_role_with_web_identity/README.md +18 -0
- data/core/edge/s3_aws_assume_role_with_web_identity/src/main.rs +34 -0
- data/core/edge/s3_read_on_wasm/.gitignore +3 -0
- data/core/edge/s3_read_on_wasm/Cargo.toml +38 -0
- data/core/edge/s3_read_on_wasm/README.md +42 -0
- data/core/edge/s3_read_on_wasm/src/lib.rs +60 -0
- data/core/edge/s3_read_on_wasm/webdriver.json +15 -0
- data/core/examples/README.md +23 -0
- data/core/examples/basic/Cargo.toml +29 -0
- data/core/examples/basic/README.md +15 -0
- data/core/examples/basic/src/main.rs +51 -0
- data/core/examples/concurrent-upload/Cargo.toml +29 -0
- data/core/examples/concurrent-upload/README.md +15 -0
- data/core/examples/concurrent-upload/src/main.rs +68 -0
- data/core/examples/multipart-upload/Cargo.toml +29 -0
- data/core/examples/multipart-upload/README.md +15 -0
- data/core/examples/multipart-upload/src/main.rs +56 -0
- data/core/fuzz/.gitignore +5 -0
- data/core/fuzz/Cargo.toml +92 -0
- data/core/fuzz/README.md +68 -0
- data/core/fuzz/fuzz_reader.rs +102 -0
- data/core/fuzz/fuzz_writer.rs +123 -0
- data/core/src/blocking/delete.rs +74 -0
- data/core/src/blocking/list.rs +71 -0
- data/core/src/blocking/mod.rs +33 -0
- data/core/src/blocking/operator.rs +729 -0
- data/core/src/blocking/read/buffer_iterator.rs +66 -0
- data/core/src/blocking/read/mod.rs +27 -0
- data/core/src/blocking/read/reader.rs +124 -0
- data/core/src/blocking/read/std_bytes_iterator.rs +69 -0
- data/core/src/blocking/read/std_reader.rs +95 -0
- data/core/src/blocking/write/mod.rs +22 -0
- data/core/src/blocking/write/std_writer.rs +82 -0
- data/core/src/blocking/write/writer.rs +109 -0
- data/core/src/docs/comparisons/mod.rs +30 -0
- data/core/src/docs/comparisons/vs_object_store.md +183 -0
- data/core/src/docs/concepts.rs +135 -0
- data/core/src/docs/internals/accessor.rs +306 -0
- data/core/src/docs/internals/layer.rs +42 -0
- data/core/src/docs/internals/mod.rs +62 -0
- data/core/src/docs/mod.rs +43 -0
- data/core/src/docs/performance/concurrent_write.md +101 -0
- data/core/src/docs/performance/http_optimization.md +124 -0
- data/core/src/docs/performance/mod.rs +32 -0
- data/core/src/docs/rfcs/0000_example.md +74 -0
- data/core/src/docs/rfcs/0000_foyer_integration.md +111 -0
- data/core/src/docs/rfcs/0041_object_native_api.md +185 -0
- data/core/src/docs/rfcs/0044_error_handle.md +198 -0
- data/core/src/docs/rfcs/0057_auto_region.md +160 -0
- data/core/src/docs/rfcs/0069_object_stream.md +145 -0
- data/core/src/docs/rfcs/0090_limited_reader.md +155 -0
- data/core/src/docs/rfcs/0112_path_normalization.md +79 -0
- data/core/src/docs/rfcs/0191_async_streaming_io.md +328 -0
- data/core/src/docs/rfcs/0203_remove_credential.md +96 -0
- data/core/src/docs/rfcs/0221_create_dir.md +89 -0
- data/core/src/docs/rfcs/0247_retryable_error.md +87 -0
- data/core/src/docs/rfcs/0293_object_id.md +67 -0
- data/core/src/docs/rfcs/0337_dir_entry.md +191 -0
- data/core/src/docs/rfcs/0409_accessor_capabilities.md +67 -0
- data/core/src/docs/rfcs/0413_presign.md +154 -0
- data/core/src/docs/rfcs/0423_command_line_interface.md +268 -0
- data/core/src/docs/rfcs/0429_init_from_iter.md +107 -0
- data/core/src/docs/rfcs/0438_multipart.md +163 -0
- data/core/src/docs/rfcs/0443_gateway.md +73 -0
- data/core/src/docs/rfcs/0501_new_builder.md +111 -0
- data/core/src/docs/rfcs/0554_write_refactor.md +96 -0
- data/core/src/docs/rfcs/0561_list_metadata_reuse.md +210 -0
- data/core/src/docs/rfcs/0599_blocking_api.md +157 -0
- data/core/src/docs/rfcs/0623_redis_service.md +300 -0
- data/core/src/docs/rfcs/0627_split_capabilities.md +89 -0
- data/core/src/docs/rfcs/0661_path_in_accessor.md +126 -0
- data/core/src/docs/rfcs/0793_generic_kv_services.md +209 -0
- data/core/src/docs/rfcs/0926_object_reader.md +93 -0
- data/core/src/docs/rfcs/0977_refactor_error.md +151 -0
- data/core/src/docs/rfcs/1085_object_handler.md +73 -0
- data/core/src/docs/rfcs/1391_object_metadataer.md +110 -0
- data/core/src/docs/rfcs/1398_query_based_metadata.md +125 -0
- data/core/src/docs/rfcs/1420_object_writer.md +147 -0
- data/core/src/docs/rfcs/1477_remove_object_concept.md +159 -0
- data/core/src/docs/rfcs/1735_operation_extension.md +117 -0
- data/core/src/docs/rfcs/2083_writer_sink_api.md +106 -0
- data/core/src/docs/rfcs/2133_append_api.md +88 -0
- data/core/src/docs/rfcs/2299_chain_based_operator_api.md +99 -0
- data/core/src/docs/rfcs/2602_object_versioning.md +138 -0
- data/core/src/docs/rfcs/2758_merge_append_into_write.md +79 -0
- data/core/src/docs/rfcs/2774_lister_api.md +66 -0
- data/core/src/docs/rfcs/2779_list_with_metakey.md +143 -0
- data/core/src/docs/rfcs/2852_native_capability.md +58 -0
- data/core/src/docs/rfcs/2884_merge_range_read_into_read.md +80 -0
- data/core/src/docs/rfcs/3017_remove_write_copy_from.md +94 -0
- data/core/src/docs/rfcs/3197_config.md +237 -0
- data/core/src/docs/rfcs/3232_align_list_api.md +69 -0
- data/core/src/docs/rfcs/3243_list_prefix.md +128 -0
- data/core/src/docs/rfcs/3356_lazy_reader.md +111 -0
- data/core/src/docs/rfcs/3526_list_recursive.md +59 -0
- data/core/src/docs/rfcs/3574_concurrent_stat_in_list.md +80 -0
- data/core/src/docs/rfcs/3734_buffered_reader.md +64 -0
- data/core/src/docs/rfcs/3898_concurrent_writer.md +66 -0
- data/core/src/docs/rfcs/3911_deleter_api.md +165 -0
- data/core/src/docs/rfcs/4382_range_based_read.md +213 -0
- data/core/src/docs/rfcs/4638_executor.md +215 -0
- data/core/src/docs/rfcs/5314_remove_metakey.md +120 -0
- data/core/src/docs/rfcs/5444_operator_from_uri.md +162 -0
- data/core/src/docs/rfcs/5479_context.md +140 -0
- data/core/src/docs/rfcs/5485_conditional_reader.md +112 -0
- data/core/src/docs/rfcs/5495_list_with_deleted.md +81 -0
- data/core/src/docs/rfcs/5556_write_returns_metadata.md +121 -0
- data/core/src/docs/rfcs/5871_read_returns_metadata.md +112 -0
- data/core/src/docs/rfcs/6189_remove_native_blocking.md +106 -0
- data/core/src/docs/rfcs/6209_glob_support.md +132 -0
- data/core/src/docs/rfcs/6213_options_api.md +142 -0
- data/core/src/docs/rfcs/README.md +62 -0
- data/core/src/docs/rfcs/mod.rs +278 -0
- data/core/src/docs/upgrade.md +1556 -0
- data/core/src/layers/async_backtrace.rs +174 -0
- data/core/src/layers/await_tree.rs +202 -0
- data/core/src/layers/capability_check.rs +239 -0
- data/core/src/layers/chaos.rs +170 -0
- data/core/src/layers/complete.rs +385 -0
- data/core/src/layers/concurrent_limit.rs +322 -0
- data/core/src/layers/correctness_check.rs +440 -0
- data/core/src/layers/dtrace.rs +294 -0
- data/core/src/layers/error_context.rs +310 -0
- data/core/src/layers/fastmetrics.rs +525 -0
- data/core/src/layers/fastrace.rs +271 -0
- data/core/src/layers/http_client.rs +206 -0
- data/core/src/layers/immutable_index.rs +408 -0
- data/core/src/layers/logging.rs +842 -0
- data/core/src/layers/metrics.rs +182 -0
- data/core/src/layers/mime_guess.rs +199 -0
- data/core/src/layers/mod.rs +130 -0
- data/core/src/layers/observe/metrics.rs +936 -0
- data/core/src/layers/observe/mod.rs +93 -0
- data/core/src/layers/otelmetrics.rs +496 -0
- data/core/src/layers/oteltrace.rs +203 -0
- data/core/src/layers/prometheus.rs +686 -0
- data/core/src/layers/prometheus_client.rs +519 -0
- data/core/src/layers/retry.rs +933 -0
- data/core/src/layers/throttle.rs +204 -0
- data/core/src/layers/timeout.rs +513 -0
- data/core/src/layers/tracing.rs +349 -0
- data/core/src/layers/type_eraser.rs +91 -0
- data/core/src/lib.rs +204 -0
- data/core/src/raw/accessor.rs +856 -0
- data/core/src/raw/adapters/kv/api.rs +164 -0
- data/core/src/raw/adapters/kv/backend.rs +253 -0
- data/core/src/raw/adapters/kv/mod.rs +31 -0
- data/core/src/raw/adapters/mod.rs +50 -0
- data/core/src/raw/adapters/typed_kv/api.rs +171 -0
- data/core/src/raw/adapters/typed_kv/backend.rs +279 -0
- data/core/src/raw/adapters/typed_kv/mod.rs +29 -0
- data/core/src/raw/atomic_util.rs +57 -0
- data/core/src/raw/azure.rs +570 -0
- data/core/src/raw/chrono_util.rs +109 -0
- data/core/src/raw/enum_utils.rs +201 -0
- data/core/src/raw/futures_util.rs +470 -0
- data/core/src/raw/http_util/body.rs +144 -0
- data/core/src/raw/http_util/bytes_content_range.rs +239 -0
- data/core/src/raw/http_util/bytes_range.rs +260 -0
- data/core/src/raw/http_util/client.rs +276 -0
- data/core/src/raw/http_util/error.rs +68 -0
- data/core/src/raw/http_util/header.rs +356 -0
- data/core/src/raw/http_util/mod.rs +78 -0
- data/core/src/raw/http_util/multipart.rs +1180 -0
- data/core/src/raw/http_util/uri.rs +190 -0
- data/core/src/raw/layer.rs +295 -0
- data/core/src/raw/mod.rs +101 -0
- data/core/src/raw/oio/buf/flex_buf.rs +118 -0
- data/core/src/raw/oio/buf/mod.rs +25 -0
- data/core/src/raw/oio/buf/pooled_buf.rs +126 -0
- data/core/src/raw/oio/buf/queue_buf.rs +117 -0
- data/core/src/raw/oio/delete/api.rs +102 -0
- data/core/src/raw/oio/delete/batch_delete.rs +127 -0
- data/core/src/raw/oio/delete/mod.rs +30 -0
- data/core/src/raw/oio/delete/one_shot_delete.rs +79 -0
- data/core/src/raw/oio/entry.rs +89 -0
- data/core/src/raw/oio/list/api.rs +69 -0
- data/core/src/raw/oio/list/flat_list.rs +137 -0
- data/core/src/raw/oio/list/hierarchy_list.rs +135 -0
- data/core/src/raw/oio/list/mod.rs +35 -0
- data/core/src/raw/oio/list/page_list.rs +105 -0
- data/core/src/raw/oio/list/prefix_list.rs +64 -0
- data/core/src/raw/oio/mod.rs +40 -0
- data/core/src/raw/oio/read/api.rs +119 -0
- data/core/src/raw/oio/read/mod.rs +21 -0
- data/core/src/raw/oio/write/api.rs +103 -0
- data/core/src/raw/oio/write/append_write.rs +111 -0
- data/core/src/raw/oio/write/block_write.rs +405 -0
- data/core/src/raw/oio/write/mod.rs +42 -0
- data/core/src/raw/oio/write/multipart_write.rs +518 -0
- data/core/src/raw/oio/write/one_shot_write.rs +77 -0
- data/core/src/raw/oio/write/position_write.rs +284 -0
- data/core/src/raw/operation.rs +88 -0
- data/core/src/raw/ops.rs +917 -0
- data/core/src/raw/path.rs +451 -0
- data/core/src/raw/path_cache.rs +244 -0
- data/core/src/raw/rps.rs +249 -0
- data/core/src/raw/serde_util.rs +423 -0
- data/core/src/raw/std_io_util.rs +65 -0
- data/core/src/raw/tests/mod.rs +30 -0
- data/core/src/raw/tests/read.rs +116 -0
- data/core/src/raw/tests/utils.rs +80 -0
- data/core/src/raw/tests/write.rs +79 -0
- data/core/src/raw/tokio_util.rs +24 -0
- data/core/src/raw/version.rs +19 -0
- data/core/src/services/aliyun_drive/backend.rs +421 -0
- data/core/src/services/aliyun_drive/config.rs +72 -0
- data/core/src/services/aliyun_drive/core.rs +651 -0
- data/core/src/services/aliyun_drive/delete.rs +51 -0
- data/core/src/services/aliyun_drive/docs.md +61 -0
- data/core/src/services/aliyun_drive/error.rs +56 -0
- data/core/src/services/aliyun_drive/lister.rs +134 -0
- data/core/src/services/aliyun_drive/mod.rs +39 -0
- data/core/src/services/aliyun_drive/writer.rs +114 -0
- data/core/src/services/alluxio/backend.rs +257 -0
- data/core/src/services/alluxio/config.rs +50 -0
- data/core/src/services/alluxio/core.rs +367 -0
- data/core/src/services/alluxio/delete.rs +38 -0
- data/core/src/services/alluxio/docs.md +45 -0
- data/core/src/services/alluxio/error.rs +99 -0
- data/core/src/services/alluxio/lister.rs +73 -0
- data/core/src/services/alluxio/mod.rs +39 -0
- data/core/src/services/alluxio/writer.rs +74 -0
- data/core/src/services/azblob/backend.rs +594 -0
- data/core/src/services/azblob/config.rs +220 -0
- data/core/src/services/azblob/core.rs +937 -0
- data/core/src/services/azblob/delete.rs +108 -0
- data/core/src/services/azblob/docs.md +77 -0
- data/core/src/services/azblob/error.rs +164 -0
- data/core/src/services/azblob/lister.rs +107 -0
- data/core/src/services/azblob/mod.rs +38 -0
- data/core/src/services/azblob/writer.rs +177 -0
- data/core/src/services/azdls/backend.rs +435 -0
- data/core/src/services/azdls/config.rs +89 -0
- data/core/src/services/azdls/core.rs +388 -0
- data/core/src/services/azdls/delete.rs +48 -0
- data/core/src/services/azdls/docs.md +73 -0
- data/core/src/services/azdls/error.rs +107 -0
- data/core/src/services/azdls/lister.rs +165 -0
- data/core/src/services/azdls/mod.rs +38 -0
- data/core/src/services/azdls/writer.rs +129 -0
- data/core/src/services/azfile/backend.rs +373 -0
- data/core/src/services/azfile/config.rs +61 -0
- data/core/src/services/azfile/core.rs +435 -0
- data/core/src/services/azfile/delete.rs +51 -0
- data/core/src/services/azfile/docs.md +65 -0
- data/core/src/services/azfile/error.rs +108 -0
- data/core/src/services/azfile/lister.rs +217 -0
- data/core/src/services/azfile/mod.rs +39 -0
- data/core/src/services/azfile/writer.rs +92 -0
- data/core/src/services/b2/backend.rs +434 -0
- data/core/src/services/b2/config.rs +64 -0
- data/core/src/services/b2/core.rs +742 -0
- data/core/src/services/b2/delete.rs +56 -0
- data/core/src/services/b2/docs.md +54 -0
- data/core/src/services/b2/error.rs +132 -0
- data/core/src/services/b2/lister.rs +110 -0
- data/core/src/services/b2/mod.rs +39 -0
- data/core/src/services/b2/writer.rs +189 -0
- data/core/src/services/cacache/backend.rs +160 -0
- data/core/src/services/cacache/config.rs +28 -0
- data/core/src/services/cacache/core.rs +96 -0
- data/core/src/services/cacache/delete.rs +39 -0
- data/core/src/services/cacache/docs.md +38 -0
- data/core/src/services/cacache/mod.rs +34 -0
- data/core/src/services/cacache/writer.rs +61 -0
- data/core/src/services/cloudflare_kv/backend.rs +513 -0
- data/core/src/services/cloudflare_kv/config.rs +55 -0
- data/core/src/services/cloudflare_kv/core.rs +168 -0
- data/core/src/services/cloudflare_kv/delete.rs +119 -0
- data/core/src/services/cloudflare_kv/docs.md +21 -0
- data/core/src/services/cloudflare_kv/error.rs +79 -0
- data/core/src/services/cloudflare_kv/lister.rs +170 -0
- data/core/src/services/cloudflare_kv/mod.rs +39 -0
- data/core/src/services/cloudflare_kv/model.rs +76 -0
- data/core/src/services/cloudflare_kv/writer.rs +68 -0
- data/core/src/services/compfs/backend.rs +290 -0
- data/core/src/services/compfs/config.rs +30 -0
- data/core/src/services/compfs/core.rs +159 -0
- data/core/src/services/compfs/delete.rs +53 -0
- data/core/src/services/compfs/lister.rs +98 -0
- data/core/src/services/compfs/mod.rs +38 -0
- data/core/src/services/compfs/reader.rs +79 -0
- data/core/src/services/compfs/writer.rs +90 -0
- data/core/src/services/cos/backend.rs +442 -0
- data/core/src/services/cos/config.rs +54 -0
- data/core/src/services/cos/core.rs +761 -0
- data/core/src/services/cos/delete.rs +48 -0
- data/core/src/services/cos/docs.md +55 -0
- data/core/src/services/cos/error.rs +105 -0
- data/core/src/services/cos/lister.rs +237 -0
- data/core/src/services/cos/mod.rs +39 -0
- data/core/src/services/cos/writer.rs +234 -0
- data/core/src/services/d1/backend.rs +330 -0
- data/core/src/services/d1/config.rs +55 -0
- data/core/src/services/d1/docs.md +48 -0
- data/core/src/services/d1/error.rs +79 -0
- data/core/src/services/d1/mod.rs +29 -0
- data/core/src/services/d1/model.rs +125 -0
- data/core/src/services/dashmap/backend.rs +203 -0
- data/core/src/services/dashmap/config.rs +37 -0
- data/core/src/services/dashmap/core.rs +61 -0
- data/core/src/services/dashmap/delete.rs +40 -0
- data/core/src/services/dashmap/docs.md +38 -0
- data/core/src/services/dashmap/lister.rs +63 -0
- data/core/src/services/dashmap/mod.rs +36 -0
- data/core/src/services/dashmap/writer.rs +87 -0
- data/core/src/services/dbfs/backend.rs +258 -0
- data/core/src/services/dbfs/config.rs +48 -0
- data/core/src/services/dbfs/core.rs +191 -0
- data/core/src/services/dbfs/delete.rs +49 -0
- data/core/src/services/dbfs/docs.md +57 -0
- data/core/src/services/dbfs/error.rs +74 -0
- data/core/src/services/dbfs/lister.rs +96 -0
- data/core/src/services/dbfs/mod.rs +38 -0
- data/core/src/services/dbfs/writer.rs +64 -0
- data/core/src/services/dropbox/backend.rs +187 -0
- data/core/src/services/dropbox/builder.rs +222 -0
- data/core/src/services/dropbox/config.rs +47 -0
- data/core/src/services/dropbox/core.rs +496 -0
- data/core/src/services/dropbox/delete.rs +54 -0
- data/core/src/services/dropbox/docs.md +64 -0
- data/core/src/services/dropbox/error.rs +85 -0
- data/core/src/services/dropbox/lister.rs +117 -0
- data/core/src/services/dropbox/mod.rs +40 -0
- data/core/src/services/dropbox/writer.rs +51 -0
- data/core/src/services/etcd/backend.rs +345 -0
- data/core/src/services/etcd/config.rs +86 -0
- data/core/src/services/etcd/core.rs +143 -0
- data/core/src/services/etcd/deleter.rs +41 -0
- data/core/src/services/etcd/docs.md +45 -0
- data/core/src/services/etcd/error.rs +26 -0
- data/core/src/services/etcd/lister.rs +79 -0
- data/core/src/services/etcd/mod.rs +36 -0
- data/core/src/services/etcd/writer.rs +61 -0
- data/core/src/services/foundationdb/backend.rs +171 -0
- data/core/src/services/foundationdb/config.rs +45 -0
- data/core/src/services/foundationdb/docs.md +42 -0
- data/core/src/services/foundationdb/mod.rs +24 -0
- data/core/src/services/fs/backend.rs +299 -0
- data/core/src/services/fs/config.rs +33 -0
- data/core/src/services/fs/core.rs +227 -0
- data/core/src/services/fs/delete.rs +53 -0
- data/core/src/services/fs/docs.md +49 -0
- data/core/src/services/fs/error.rs +31 -0
- data/core/src/services/fs/lister.rs +81 -0
- data/core/src/services/fs/mod.rs +40 -0
- data/core/src/services/fs/reader.rs +83 -0
- data/core/src/services/fs/writer.rs +212 -0
- data/core/src/services/ftp/backend.rs +388 -0
- data/core/src/services/ftp/config.rs +46 -0
- data/core/src/services/ftp/core.rs +136 -0
- data/core/src/services/ftp/delete.rs +62 -0
- data/core/src/services/ftp/docs.md +42 -0
- data/core/src/services/ftp/err.rs +47 -0
- data/core/src/services/ftp/lister.rs +72 -0
- data/core/src/services/ftp/mod.rs +41 -0
- data/core/src/services/ftp/reader.rs +84 -0
- data/core/src/services/ftp/writer.rs +122 -0
- data/core/src/services/gcs/backend.rs +499 -0
- data/core/src/services/gcs/config.rs +168 -0
- data/core/src/services/gcs/core.rs +1079 -0
- data/core/src/services/gcs/delete.rs +98 -0
- data/core/src/services/gcs/docs.md +76 -0
- data/core/src/services/gcs/error.rs +122 -0
- data/core/src/services/gcs/lister.rs +136 -0
- data/core/src/services/gcs/mod.rs +40 -0
- data/core/src/services/gcs/uri.rs +75 -0
- data/core/src/services/gcs/writer.rs +163 -0
- data/core/src/services/gdrive/backend.rs +176 -0
- data/core/src/services/gdrive/builder.rs +228 -0
- data/core/src/services/gdrive/config.rs +47 -0
- data/core/src/services/gdrive/core.rs +499 -0
- data/core/src/services/gdrive/delete.rs +57 -0
- data/core/src/services/gdrive/docs.md +65 -0
- data/core/src/services/gdrive/error.rs +80 -0
- data/core/src/services/gdrive/lister.rs +110 -0
- data/core/src/services/gdrive/mod.rs +40 -0
- data/core/src/services/gdrive/writer.rs +77 -0
- data/core/src/services/ghac/backend.rs +285 -0
- data/core/src/services/ghac/config.rs +36 -0
- data/core/src/services/ghac/core.rs +459 -0
- data/core/src/services/ghac/docs.md +84 -0
- data/core/src/services/ghac/error.rs +52 -0
- data/core/src/services/ghac/mod.rs +35 -0
- data/core/src/services/ghac/writer.rs +201 -0
- data/core/src/services/github/backend.rs +285 -0
- data/core/src/services/github/config.rs +59 -0
- data/core/src/services/github/core.rs +351 -0
- data/core/src/services/github/delete.rs +41 -0
- data/core/src/services/github/docs.md +52 -0
- data/core/src/services/github/error.rs +101 -0
- data/core/src/services/github/lister.rs +112 -0
- data/core/src/services/github/mod.rs +38 -0
- data/core/src/services/github/writer.rs +51 -0
- data/core/src/services/gridfs/backend.rs +166 -0
- data/core/src/services/gridfs/config.rs +50 -0
- data/core/src/services/gridfs/core.rs +154 -0
- data/core/src/services/gridfs/docs.md +46 -0
- data/core/src/services/gridfs/mod.rs +26 -0
- data/core/src/services/hdfs/backend.rs +413 -0
- data/core/src/services/hdfs/config.rs +59 -0
- data/core/src/services/hdfs/delete.rs +62 -0
- data/core/src/services/hdfs/docs.md +140 -0
- data/core/src/services/hdfs/lister.rs +70 -0
- data/core/src/services/hdfs/mod.rs +36 -0
- data/core/src/services/hdfs/reader.rs +79 -0
- data/core/src/services/hdfs/writer.rs +104 -0
- data/core/src/services/hdfs_native/backend.rs +340 -0
- data/core/src/services/hdfs_native/config.rs +45 -0
- data/core/src/services/hdfs_native/delete.rs +47 -0
- data/core/src/services/hdfs_native/docs.md +35 -0
- data/core/src/services/hdfs_native/error.rs +59 -0
- data/core/src/services/hdfs_native/lister.rs +85 -0
- data/core/src/services/hdfs_native/mod.rs +39 -0
- data/core/src/services/hdfs_native/reader.rs +62 -0
- data/core/src/services/hdfs_native/writer.rs +61 -0
- data/core/src/services/http/backend.rs +291 -0
- data/core/src/services/http/config.rs +49 -0
- data/core/src/services/http/core.rs +125 -0
- data/core/src/services/http/docs.md +45 -0
- data/core/src/services/http/error.rs +53 -0
- data/core/src/services/http/mod.rs +32 -0
- data/core/src/services/huggingface/backend.rs +289 -0
- data/core/src/services/huggingface/config.rs +75 -0
- data/core/src/services/huggingface/core.rs +406 -0
- data/core/src/services/huggingface/docs.md +61 -0
- data/core/src/services/huggingface/error.rs +93 -0
- data/core/src/services/huggingface/lister.rs +91 -0
- data/core/src/services/huggingface/mod.rs +34 -0
- data/core/src/services/ipfs/backend.rs +257 -0
- data/core/src/services/ipfs/config.rs +32 -0
- data/core/src/services/ipfs/core.rs +239 -0
- data/core/src/services/ipfs/docs.md +45 -0
- data/core/src/services/ipfs/error.rs +52 -0
- data/core/src/services/ipfs/ipld.rs +162 -0
- data/core/src/services/ipfs/mod.rs +34 -0
- data/core/src/services/ipmfs/backend.rs +147 -0
- data/core/src/services/ipmfs/builder.rs +166 -0
- data/core/src/services/ipmfs/config.rs +32 -0
- data/core/src/services/ipmfs/core.rs +142 -0
- data/core/src/services/ipmfs/delete.rs +48 -0
- data/core/src/services/ipmfs/docs.md +14 -0
- data/core/src/services/ipmfs/error.rs +83 -0
- data/core/src/services/ipmfs/lister.rs +135 -0
- data/core/src/services/ipmfs/mod.rs +40 -0
- data/core/src/services/ipmfs/writer.rs +49 -0
- data/core/src/services/koofr/backend.rs +361 -0
- data/core/src/services/koofr/config.rs +50 -0
- data/core/src/services/koofr/core.rs +458 -0
- data/core/src/services/koofr/delete.rs +50 -0
- data/core/src/services/koofr/docs.md +51 -0
- data/core/src/services/koofr/error.rs +72 -0
- data/core/src/services/koofr/lister.rs +88 -0
- data/core/src/services/koofr/mod.rs +38 -0
- data/core/src/services/koofr/writer.rs +53 -0
- data/core/src/services/lakefs/backend.rs +309 -0
- data/core/src/services/lakefs/config.rs +81 -0
- data/core/src/services/lakefs/core.rs +261 -0
- data/core/src/services/lakefs/delete.rs +54 -0
- data/core/src/services/lakefs/docs.md +62 -0
- data/core/src/services/lakefs/error.rs +93 -0
- data/core/src/services/lakefs/lister.rs +120 -0
- data/core/src/services/lakefs/mod.rs +38 -0
- data/core/src/services/lakefs/writer.rs +50 -0
- data/core/src/services/memcached/backend.rs +284 -0
- data/core/src/services/memcached/binary.rs +289 -0
- data/core/src/services/memcached/config.rs +43 -0
- data/core/src/services/memcached/docs.md +47 -0
- data/core/src/services/memcached/mod.rs +27 -0
- data/core/src/services/memory/backend.rs +205 -0
- data/core/src/services/memory/config.rs +30 -0
- data/core/src/services/memory/core.rs +80 -0
- data/core/src/services/memory/delete.rs +42 -0
- data/core/src/services/memory/docs.md +36 -0
- data/core/src/services/memory/lister.rs +56 -0
- data/core/src/services/memory/mod.rs +36 -0
- data/core/src/services/memory/writer.rs +85 -0
- data/core/src/services/mini_moka/backend.rs +260 -0
- data/core/src/services/mini_moka/config.rs +56 -0
- data/core/src/services/mini_moka/core.rs +52 -0
- data/core/src/services/mini_moka/delete.rs +42 -0
- data/core/src/services/mini_moka/docs.md +19 -0
- data/core/src/services/mini_moka/lister.rs +68 -0
- data/core/src/services/mini_moka/mod.rs +36 -0
- data/core/src/services/mini_moka/writer.rs +84 -0
- data/core/src/services/mod.rs +206 -0
- data/core/src/services/moka/backend.rs +326 -0
- data/core/src/services/moka/config.rs +59 -0
- data/core/src/services/moka/core.rs +62 -0
- data/core/src/services/moka/delete.rs +42 -0
- data/core/src/services/moka/docs.md +42 -0
- data/core/src/services/moka/lister.rs +65 -0
- data/core/src/services/moka/mod.rs +41 -0
- data/core/src/services/moka/writer.rs +83 -0
- data/core/src/services/mongodb/backend.rs +291 -0
- data/core/src/services/mongodb/config.rs +54 -0
- data/core/src/services/mongodb/docs.md +49 -0
- data/core/src/services/mongodb/mod.rs +24 -0
- data/core/src/services/monoiofs/backend.rs +238 -0
- data/core/src/services/monoiofs/config.rs +34 -0
- data/core/src/services/monoiofs/core.rs +313 -0
- data/core/src/services/monoiofs/delete.rs +64 -0
- data/core/src/services/monoiofs/docs.md +46 -0
- data/core/src/services/monoiofs/mod.rs +36 -0
- data/core/src/services/monoiofs/reader.rs +147 -0
- data/core/src/services/monoiofs/writer.rs +189 -0
- data/core/src/services/mysql/backend.rs +256 -0
- data/core/src/services/mysql/config.rs +66 -0
- data/core/src/services/mysql/docs.md +47 -0
- data/core/src/services/mysql/mod.rs +24 -0
- data/core/src/services/obs/backend.rs +442 -0
- data/core/src/services/obs/config.rs +53 -0
- data/core/src/services/obs/core.rs +608 -0
- data/core/src/services/obs/delete.rs +48 -0
- data/core/src/services/obs/docs.md +54 -0
- data/core/src/services/obs/error.rs +106 -0
- data/core/src/services/obs/lister.rs +101 -0
- data/core/src/services/obs/mod.rs +38 -0
- data/core/src/services/obs/writer.rs +235 -0
- data/core/src/services/onedrive/backend.rs +127 -0
- data/core/src/services/onedrive/builder.rs +236 -0
- data/core/src/services/onedrive/config.rs +49 -0
- data/core/src/services/onedrive/core.rs +691 -0
- data/core/src/services/onedrive/delete.rs +47 -0
- data/core/src/services/onedrive/docs.md +115 -0
- data/core/src/services/onedrive/error.rs +61 -0
- data/core/src/services/onedrive/graph_model.rs +425 -0
- data/core/src/services/onedrive/lister.rs +150 -0
- data/core/src/services/onedrive/mod.rs +42 -0
- data/core/src/services/onedrive/writer.rs +168 -0
- data/core/src/services/opfs/backend.rs +50 -0
- data/core/src/services/opfs/config.rs +25 -0
- data/core/src/services/opfs/core.rs +74 -0
- data/core/src/services/opfs/docs.md +18 -0
- data/core/src/services/opfs/error.rs +27 -0
- data/core/src/services/opfs/mod.rs +30 -0
- data/core/src/services/opfs/utils.rs +70 -0
- data/core/src/services/oss/backend.rs +734 -0
- data/core/src/services/oss/config.rs +113 -0
- data/core/src/services/oss/core.rs +1088 -0
- data/core/src/services/oss/delete.rs +109 -0
- data/core/src/services/oss/docs.md +74 -0
- data/core/src/services/oss/error.rs +109 -0
- data/core/src/services/oss/lister.rs +256 -0
- data/core/src/services/oss/mod.rs +38 -0
- data/core/src/services/oss/writer.rs +228 -0
- data/core/src/services/pcloud/backend.rs +358 -0
- data/core/src/services/pcloud/config.rs +51 -0
- data/core/src/services/pcloud/core.rs +461 -0
- data/core/src/services/pcloud/delete.rs +66 -0
- data/core/src/services/pcloud/docs.md +51 -0
- data/core/src/services/pcloud/error.rs +88 -0
- data/core/src/services/pcloud/lister.rs +95 -0
- data/core/src/services/pcloud/mod.rs +38 -0
- data/core/src/services/pcloud/writer.rs +66 -0
- data/core/src/services/persy/backend.rs +226 -0
- data/core/src/services/persy/config.rs +32 -0
- data/core/src/services/persy/docs.md +43 -0
- data/core/src/services/persy/mod.rs +24 -0
- data/core/src/services/postgresql/backend.rs +258 -0
- data/core/src/services/postgresql/config.rs +66 -0
- data/core/src/services/postgresql/docs.md +47 -0
- data/core/src/services/postgresql/mod.rs +24 -0
- data/core/src/services/redb/backend.rs +280 -0
- data/core/src/services/redb/config.rs +34 -0
- data/core/src/services/redb/docs.md +41 -0
- data/core/src/services/redb/mod.rs +24 -0
- data/core/src/services/redis/backend.rs +442 -0
- data/core/src/services/redis/config.rs +79 -0
- data/core/src/services/redis/core.rs +209 -0
- data/core/src/services/redis/delete.rs +40 -0
- data/core/src/services/redis/docs.md +43 -0
- data/core/src/services/redis/mod.rs +34 -0
- data/core/src/services/redis/writer.rs +57 -0
- data/core/src/services/rocksdb/backend.rs +159 -0
- data/core/src/services/rocksdb/config.rs +34 -0
- data/core/src/services/rocksdb/docs.md +54 -0
- data/core/src/services/rocksdb/mod.rs +24 -0
- data/core/src/services/s3/backend.rs +1293 -0
- data/core/src/services/s3/compatible_services.md +126 -0
- data/core/src/services/s3/config.rs +327 -0
- data/core/src/services/s3/core.rs +1741 -0
- data/core/src/services/s3/delete.rs +109 -0
- data/core/src/services/s3/docs.md +244 -0
- data/core/src/services/s3/error.rs +171 -0
- data/core/src/services/s3/lister.rs +405 -0
- data/core/src/services/s3/mod.rs +38 -0
- data/core/src/services/s3/writer.rs +262 -0
- data/core/src/services/seafile/backend.rs +297 -0
- data/core/src/services/seafile/config.rs +56 -0
- data/core/src/services/seafile/core.rs +475 -0
- data/core/src/services/seafile/delete.rs +40 -0
- data/core/src/services/seafile/docs.md +54 -0
- data/core/src/services/seafile/error.rs +86 -0
- data/core/src/services/seafile/lister.rs +83 -0
- data/core/src/services/seafile/mod.rs +38 -0
- data/core/src/services/seafile/writer.rs +55 -0
- data/core/src/services/sftp/backend.rs +397 -0
- data/core/src/services/sftp/config.rs +50 -0
- data/core/src/services/sftp/core.rs +154 -0
- data/core/src/services/sftp/delete.rs +55 -0
- data/core/src/services/sftp/docs.md +49 -0
- data/core/src/services/sftp/error.rs +57 -0
- data/core/src/services/sftp/lister.rs +88 -0
- data/core/src/services/sftp/mod.rs +42 -0
- data/core/src/services/sftp/reader.rs +78 -0
- data/core/src/services/sftp/utils.rs +51 -0
- data/core/src/services/sftp/writer.rs +67 -0
- data/core/src/services/sled/backend.rs +194 -0
- data/core/src/services/sled/config.rs +45 -0
- data/core/src/services/sled/docs.md +39 -0
- data/core/src/services/sled/mod.rs +24 -0
- data/core/src/services/sqlite/backend.rs +326 -0
- data/core/src/services/sqlite/config.rs +70 -0
- data/core/src/services/sqlite/docs.md +46 -0
- data/core/src/services/sqlite/mod.rs +24 -0
- data/core/src/services/surrealdb/backend.rs +365 -0
- data/core/src/services/surrealdb/config.rs +64 -0
- data/core/src/services/surrealdb/docs.md +54 -0
- data/core/src/services/surrealdb/mod.rs +24 -0
- data/core/src/services/swift/backend.rs +275 -0
- data/core/src/services/swift/compatible_services.md +53 -0
- data/core/src/services/swift/config.rs +53 -0
- data/core/src/services/swift/core.rs +310 -0
- data/core/src/services/swift/delete.rs +49 -0
- data/core/src/services/swift/docs.md +52 -0
- data/core/src/services/swift/error.rs +90 -0
- data/core/src/services/swift/lister.rs +119 -0
- data/core/src/services/swift/mod.rs +38 -0
- data/core/src/services/swift/writer.rs +53 -0
- data/core/src/services/tikv/backend.rs +237 -0
- data/core/src/services/tikv/config.rs +52 -0
- data/core/src/services/tikv/docs.md +43 -0
- data/core/src/services/tikv/mod.rs +24 -0
- data/core/src/services/upyun/backend.rs +317 -0
- data/core/src/services/upyun/config.rs +51 -0
- data/core/src/services/upyun/core.rs +521 -0
- data/core/src/services/upyun/delete.rs +50 -0
- data/core/src/services/upyun/docs.md +51 -0
- data/core/src/services/upyun/error.rs +97 -0
- data/core/src/services/upyun/lister.rs +101 -0
- data/core/src/services/upyun/mod.rs +38 -0
- data/core/src/services/upyun/writer.rs +127 -0
- data/core/src/services/vercel_artifacts/backend.rs +99 -0
- data/core/src/services/vercel_artifacts/builder.rs +117 -0
- data/core/src/services/vercel_artifacts/config.rs +39 -0
- data/core/src/services/vercel_artifacts/core.rs +112 -0
- data/core/src/services/vercel_artifacts/docs.md +40 -0
- data/core/src/services/vercel_artifacts/error.rs +50 -0
- data/core/src/services/vercel_artifacts/mod.rs +36 -0
- data/core/src/services/vercel_artifacts/writer.rs +58 -0
- data/core/src/services/vercel_blob/backend.rs +251 -0
- data/core/src/services/vercel_blob/config.rs +45 -0
- data/core/src/services/vercel_blob/core.rs +449 -0
- data/core/src/services/vercel_blob/delete.rs +38 -0
- data/core/src/services/vercel_blob/docs.md +45 -0
- data/core/src/services/vercel_blob/error.rs +110 -0
- data/core/src/services/vercel_blob/lister.rs +69 -0
- data/core/src/services/vercel_blob/mod.rs +38 -0
- data/core/src/services/vercel_blob/writer.rs +143 -0
- data/core/src/services/webdav/backend.rs +318 -0
- data/core/src/services/webdav/config.rs +53 -0
- data/core/src/services/webdav/core.rs +859 -0
- data/core/src/services/webdav/delete.rs +47 -0
- data/core/src/services/webdav/docs.md +49 -0
- data/core/src/services/webdav/error.rs +53 -0
- data/core/src/services/webdav/lister.rs +106 -0
- data/core/src/services/webdav/mod.rs +38 -0
- data/core/src/services/webdav/writer.rs +56 -0
- data/core/src/services/webhdfs/backend.rs +376 -0
- data/core/src/services/webhdfs/config.rs +52 -0
- data/core/src/services/webhdfs/core.rs +398 -0
- data/core/src/services/webhdfs/delete.rs +46 -0
- data/core/src/services/webhdfs/docs.md +90 -0
- data/core/src/services/webhdfs/error.rs +126 -0
- data/core/src/services/webhdfs/lister.rs +130 -0
- data/core/src/services/webhdfs/message.rs +249 -0
- data/core/src/services/webhdfs/mod.rs +41 -0
- data/core/src/services/webhdfs/writer.rs +177 -0
- data/core/src/services/yandex_disk/backend.rs +267 -0
- data/core/src/services/yandex_disk/config.rs +45 -0
- data/core/src/services/yandex_disk/core.rs +340 -0
- data/core/src/services/yandex_disk/delete.rs +54 -0
- data/core/src/services/yandex_disk/docs.md +45 -0
- data/core/src/services/yandex_disk/error.rs +104 -0
- data/core/src/services/yandex_disk/lister.rs +113 -0
- data/core/src/services/yandex_disk/mod.rs +38 -0
- data/core/src/services/yandex_disk/writer.rs +52 -0
- data/core/src/types/buffer.rs +991 -0
- data/core/src/types/builder.rs +152 -0
- data/core/src/types/capability.rs +209 -0
- data/core/src/types/context/mod.rs +22 -0
- data/core/src/types/context/read.rs +231 -0
- data/core/src/types/context/write.rs +441 -0
- data/core/src/types/delete/deleter.rs +220 -0
- data/core/src/types/delete/futures_delete_sink.rs +176 -0
- data/core/src/types/delete/input.rs +97 -0
- data/core/src/types/delete/mod.rs +26 -0
- data/core/src/types/entry.rs +69 -0
- data/core/src/types/error.rs +570 -0
- data/core/src/types/execute/api.rs +110 -0
- data/core/src/types/execute/executor.rs +96 -0
- data/core/src/types/execute/executors/mod.rs +27 -0
- data/core/src/types/execute/executors/tokio_executor.rs +60 -0
- data/core/src/types/execute/mod.rs +25 -0
- data/core/src/types/list.rs +137 -0
- data/core/src/types/metadata.rs +436 -0
- data/core/src/types/mod.rs +72 -0
- data/core/src/types/mode.rs +68 -0
- data/core/src/types/operator/builder.rs +535 -0
- data/core/src/types/operator/info.rs +63 -0
- data/core/src/types/operator/mod.rs +33 -0
- data/core/src/types/operator/operator.rs +2236 -0
- data/core/src/types/operator/operator_futures.rs +1430 -0
- data/core/src/types/operator/registry.rs +129 -0
- data/core/src/types/options.rs +548 -0
- data/core/src/types/read/buffer_stream.rs +273 -0
- data/core/src/types/read/futures_async_reader.rs +289 -0
- data/core/src/types/read/futures_bytes_stream.rs +157 -0
- data/core/src/types/read/mod.rs +29 -0
- data/core/src/types/read/reader.rs +604 -0
- data/core/src/types/scheme.rs +475 -0
- data/core/src/types/write/buffer_sink.rs +188 -0
- data/core/src/types/write/futures_async_writer.rs +136 -0
- data/core/src/types/write/futures_bytes_sink.rs +103 -0
- data/core/src/types/write/mod.rs +26 -0
- data/core/src/types/write/writer.rs +411 -0
- data/core/tests/behavior/README.md +77 -0
- data/core/tests/behavior/async_copy.rs +314 -0
- data/core/tests/behavior/async_create_dir.rs +53 -0
- data/core/tests/behavior/async_delete.rs +354 -0
- data/core/tests/behavior/async_list.rs +739 -0
- data/core/tests/behavior/async_presign.rs +175 -0
- data/core/tests/behavior/async_read.rs +871 -0
- data/core/tests/behavior/async_rename.rs +210 -0
- data/core/tests/behavior/async_stat.rs +628 -0
- data/core/tests/behavior/async_write.rs +819 -0
- data/core/tests/behavior/main.rs +78 -0
- data/core/tests/behavior/utils.rs +187 -0
- data/core/tests/data/normal_dir/.gitkeep +0 -0
- data/core/tests/data/normal_file.txt +1041 -0
- data/core/tests/data/special_dir !@#$%^&()_+-=;',/.gitkeep +0 -0
- data/core/tests/data/special_file !@#$%^&()_+-=;',.txt +1041 -0
- data/core/users.md +13 -0
- data/extconf.rb +24 -0
- data/lib/opendal.rb +25 -0
- data/lib/opendal_ruby/entry.rb +35 -0
- data/lib/opendal_ruby/io.rb +70 -0
- data/lib/opendal_ruby/metadata.rb +44 -0
- data/lib/opendal_ruby/operator.rb +29 -0
- data/lib/opendal_ruby/operator_info.rb +26 -0
- data/src/capability.rs +146 -0
- data/src/io.rs +464 -0
- data/src/lib.rs +63 -0
- data/src/lister.rs +141 -0
- data/src/metadata.rs +111 -0
- data/src/middlewares.rs +174 -0
- data/src/operator.rs +310 -0
- data/src/operator_info.rs +83 -0
- data/test/blocking_op_test.rb +112 -0
- data/test/capability_test.rb +42 -0
- data/test/io_test.rb +172 -0
- data/test/lister_test.rb +77 -0
- data/test/metadata_test.rb +78 -0
- data/test/middlewares_test.rb +46 -0
- data/test/operator_info_test.rb +35 -0
- data/test/test_helper.rb +36 -0
- metadata +857 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
|
|
18
|
+
use std::collections::HashMap;
|
|
19
|
+
use std::sync::{LazyLock, Mutex};
|
|
20
|
+
|
|
21
|
+
use http::Uri;
|
|
22
|
+
use percent_encoding::percent_decode_str;
|
|
23
|
+
|
|
24
|
+
use crate::services;
|
|
25
|
+
use crate::types::builder::{Builder, Configurator};
|
|
26
|
+
use crate::{Error, ErrorKind, Operator, Result};
|
|
27
|
+
|
|
28
|
+
/// Factory signature used to construct [`Operator`] from a URI and extra options.
|
|
29
|
+
pub type OperatorFactory = fn(&str, Vec<(String, String)>) -> Result<Operator>;
|
|
30
|
+
|
|
31
|
+
/// Default registry initialized with builtin services.
|
|
32
|
+
pub static DEFAULT_OPERATOR_REGISTRY: LazyLock<OperatorRegistry> = LazyLock::new(|| {
|
|
33
|
+
let registry = OperatorRegistry::new();
|
|
34
|
+
register_builtin_services(®istry);
|
|
35
|
+
registry
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/// Global registry that maps schemes to [`OperatorFactory`] functions.
|
|
39
|
+
#[derive(Debug, Default)]
|
|
40
|
+
pub struct OperatorRegistry {
|
|
41
|
+
factories: Mutex<HashMap<String, OperatorFactory>>,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
impl OperatorRegistry {
|
|
45
|
+
/// Create a new, empty registry.
|
|
46
|
+
pub fn new() -> Self {
|
|
47
|
+
Self {
|
|
48
|
+
factories: Mutex::new(HashMap::new()),
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// Register a builder for the given scheme.
|
|
53
|
+
pub fn register<B: Builder>(&self, scheme: &str) {
|
|
54
|
+
let key = scheme.to_ascii_lowercase();
|
|
55
|
+
let mut guard = self
|
|
56
|
+
.factories
|
|
57
|
+
.lock()
|
|
58
|
+
.expect("operator registry mutex poisoned");
|
|
59
|
+
guard.insert(key, factory::<B::Config>);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// Load an [`Operator`] via the factory registered for the URI's scheme.
|
|
63
|
+
pub fn load(
|
|
64
|
+
&self,
|
|
65
|
+
uri: &str,
|
|
66
|
+
options: impl IntoIterator<Item = (String, String)>,
|
|
67
|
+
) -> Result<Operator> {
|
|
68
|
+
let parsed = uri.parse::<Uri>().map_err(|err| {
|
|
69
|
+
Error::new(ErrorKind::ConfigInvalid, "failed to parse uri").set_source(err)
|
|
70
|
+
})?;
|
|
71
|
+
|
|
72
|
+
let scheme = parsed
|
|
73
|
+
.scheme_str()
|
|
74
|
+
.ok_or_else(|| Error::new(ErrorKind::ConfigInvalid, "uri scheme is required"))?;
|
|
75
|
+
|
|
76
|
+
let key = scheme.to_ascii_lowercase();
|
|
77
|
+
let factory = self
|
|
78
|
+
.factories
|
|
79
|
+
.lock()
|
|
80
|
+
.expect("operator registry mutex poisoned")
|
|
81
|
+
.get(key.as_str())
|
|
82
|
+
.copied()
|
|
83
|
+
.ok_or_else(|| {
|
|
84
|
+
Error::new(ErrorKind::Unsupported, "scheme is not registered")
|
|
85
|
+
.with_context("scheme", scheme)
|
|
86
|
+
})?;
|
|
87
|
+
|
|
88
|
+
let opts: Vec<(String, String)> = options.into_iter().collect();
|
|
89
|
+
factory(uri, opts)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fn register_builtin_services(registry: &OperatorRegistry) {
|
|
94
|
+
#[cfg(feature = "services-memory")]
|
|
95
|
+
registry.register::<services::Memory>(services::MEMORY_SCHEME);
|
|
96
|
+
#[cfg(feature = "services-fs")]
|
|
97
|
+
registry.register::<services::Fs>(services::FS_SCHEME);
|
|
98
|
+
#[cfg(feature = "services-s3")]
|
|
99
|
+
registry.register::<services::S3>(services::S3_SCHEME);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/// Factory adapter that builds an operator from a configurator type.
|
|
103
|
+
fn factory<C: Configurator>(uri: &str, options: Vec<(String, String)>) -> Result<Operator> {
|
|
104
|
+
let parsed = uri.parse::<Uri>().map_err(|err| {
|
|
105
|
+
Error::new(ErrorKind::ConfigInvalid, "failed to parse uri").set_source(err)
|
|
106
|
+
})?;
|
|
107
|
+
|
|
108
|
+
let mut params = HashMap::new();
|
|
109
|
+
if let Some(query) = parsed.query() {
|
|
110
|
+
for pair in query.split('&') {
|
|
111
|
+
if pair.is_empty() {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
let mut parts = pair.splitn(2, '=');
|
|
115
|
+
let key = parts.next().unwrap_or("");
|
|
116
|
+
let value = parts.next().unwrap_or("");
|
|
117
|
+
let key = percent_decode_str(key).decode_utf8_lossy().to_string();
|
|
118
|
+
let value = percent_decode_str(value).decode_utf8_lossy().to_string();
|
|
119
|
+
params.insert(key.to_ascii_lowercase(), value);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
for (key, value) in options {
|
|
124
|
+
params.insert(key.to_ascii_lowercase(), value);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
let cfg = C::from_uri(&parsed, ¶ms)?;
|
|
128
|
+
Ok(Operator::from_config(cfg)?.finish())
|
|
129
|
+
}
|
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
// Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
|
|
18
|
+
//! Options module provides options definitions for operations.
|
|
19
|
+
|
|
20
|
+
use std::collections::HashMap;
|
|
21
|
+
|
|
22
|
+
use chrono::DateTime;
|
|
23
|
+
use chrono::Utc;
|
|
24
|
+
|
|
25
|
+
use crate::raw::BytesRange;
|
|
26
|
+
|
|
27
|
+
/// Options for delete operations.
|
|
28
|
+
#[derive(Debug, Clone, Default, Eq, PartialEq)]
|
|
29
|
+
pub struct DeleteOptions {
|
|
30
|
+
/// The version of the file to delete.
|
|
31
|
+
pub version: Option<String>,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/// Options for list operations.
|
|
35
|
+
|
|
36
|
+
#[derive(Debug, Clone, Default, Eq, PartialEq)]
|
|
37
|
+
pub struct ListOptions {
|
|
38
|
+
/// The limit passed to underlying service to specify the max results
|
|
39
|
+
/// that could return per-request.
|
|
40
|
+
///
|
|
41
|
+
/// Users could use this to control the memory usage of list operation.
|
|
42
|
+
pub limit: Option<usize>,
|
|
43
|
+
/// The start_after passes to underlying service to specify the specified key
|
|
44
|
+
/// to start listing from.
|
|
45
|
+
pub start_after: Option<String>,
|
|
46
|
+
/// The recursive is used to control whether the list operation is recursive.
|
|
47
|
+
///
|
|
48
|
+
/// - If `false`, list operation will only list the entries under the given path.
|
|
49
|
+
/// - If `true`, list operation will list all entries that starts with given path.
|
|
50
|
+
///
|
|
51
|
+
/// Default to `false`.
|
|
52
|
+
pub recursive: bool,
|
|
53
|
+
/// The version is used to control whether the object versions should be returned.
|
|
54
|
+
///
|
|
55
|
+
/// - If `false`, list operation will not return with object versions
|
|
56
|
+
/// - If `true`, list operation will return with object versions if object versioning is supported
|
|
57
|
+
/// by the underlying service
|
|
58
|
+
///
|
|
59
|
+
/// Default to `false`
|
|
60
|
+
pub versions: bool,
|
|
61
|
+
/// The deleted is used to control whether the deleted objects should be returned.
|
|
62
|
+
///
|
|
63
|
+
/// - If `false`, list operation will not return with deleted objects
|
|
64
|
+
/// - If `true`, list operation will return with deleted objects if object versioning is supported
|
|
65
|
+
/// by the underlying service
|
|
66
|
+
///
|
|
67
|
+
/// Default to `false`
|
|
68
|
+
pub deleted: bool,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// Options for read operations.
|
|
72
|
+
#[derive(Debug, Clone, Default, Eq, PartialEq)]
|
|
73
|
+
pub struct ReadOptions {
|
|
74
|
+
/// Set `range` for this operation.
|
|
75
|
+
///
|
|
76
|
+
/// If we have a file with size `n`.
|
|
77
|
+
///
|
|
78
|
+
/// - `..` means read bytes in range `[0, n)` of file.
|
|
79
|
+
/// - `0..1024` and `..1024` means read bytes in range `[0, 1024)` of file
|
|
80
|
+
/// - `1024..` means read bytes in range `[1024, n)` of file
|
|
81
|
+
///
|
|
82
|
+
/// The type implements `From<RangeBounds<u64>>`, so users can use `(1024..).into()` instead.
|
|
83
|
+
pub range: BytesRange,
|
|
84
|
+
/// Set `version` for this operation.
|
|
85
|
+
///
|
|
86
|
+
/// This option can be used to retrieve the data of a specified version of the given path.
|
|
87
|
+
///
|
|
88
|
+
/// If the version doesn't exist, an error with kind [`ErrorKind::NotFound`] will be returned.
|
|
89
|
+
pub version: Option<String>,
|
|
90
|
+
|
|
91
|
+
/// Set `if_match` for this operation.
|
|
92
|
+
///
|
|
93
|
+
/// This option can be used to check if the file's `ETag` matches the given `ETag`.
|
|
94
|
+
///
|
|
95
|
+
/// If file exists and it's etag doesn't match, an error with kind [`ErrorKind::ConditionNotMatch`]
|
|
96
|
+
/// will be returned.
|
|
97
|
+
pub if_match: Option<String>,
|
|
98
|
+
/// Set `if_none_match` for this operation.
|
|
99
|
+
///
|
|
100
|
+
/// This option can be used to check if the file's `ETag` doesn't match the given `ETag`.
|
|
101
|
+
///
|
|
102
|
+
/// If file exists and it's etag match, an error with kind [`ErrorKind::ConditionNotMatch`]
|
|
103
|
+
/// will be returned.
|
|
104
|
+
pub if_none_match: Option<String>,
|
|
105
|
+
/// Set `if_modified_since` for this operation.
|
|
106
|
+
///
|
|
107
|
+
/// This option can be used to check if the file has been modified since the given timestamp.
|
|
108
|
+
///
|
|
109
|
+
/// If file exists and it hasn't been modified since the specified time, an error with kind
|
|
110
|
+
/// [`ErrorKind::ConditionNotMatch`] will be returned.
|
|
111
|
+
pub if_modified_since: Option<DateTime<Utc>>,
|
|
112
|
+
/// Set `if_unmodified_since` for this operation.
|
|
113
|
+
///
|
|
114
|
+
/// This feature can be used to check if the file hasn't been modified since the given timestamp.
|
|
115
|
+
///
|
|
116
|
+
/// If file exists and it has been modified since the specified time, an error with kind
|
|
117
|
+
/// [`ErrorKind::ConditionNotMatch`] will be returned.
|
|
118
|
+
pub if_unmodified_since: Option<DateTime<Utc>>,
|
|
119
|
+
|
|
120
|
+
/// Set `concurrent` for the operation.
|
|
121
|
+
///
|
|
122
|
+
/// OpenDAL by default to read file without concurrent. This is not efficient for cases when users
|
|
123
|
+
/// read large chunks of data. By setting `concurrent`, opendal will reading files concurrently
|
|
124
|
+
/// on support storage services.
|
|
125
|
+
///
|
|
126
|
+
/// By setting `concurrent`, opendal will fetch chunks concurrently with
|
|
127
|
+
/// the give chunk size.
|
|
128
|
+
///
|
|
129
|
+
/// Refer to [`crate::docs::performance`] for more details.
|
|
130
|
+
pub concurrent: usize,
|
|
131
|
+
/// Set `chunk` for the operation.
|
|
132
|
+
///
|
|
133
|
+
/// OpenDAL will use services' preferred chunk size by default. Users can set chunk based on their own needs.
|
|
134
|
+
///
|
|
135
|
+
/// Refer to [`crate::docs::performance`] for more details.
|
|
136
|
+
pub chunk: Option<usize>,
|
|
137
|
+
/// Controls the optimization strategy for range reads in [`Reader::fetch`].
|
|
138
|
+
///
|
|
139
|
+
/// When performing range reads, if the gap between two requested ranges is smaller than
|
|
140
|
+
/// the configured `gap` size, OpenDAL will merge these ranges into a single read request
|
|
141
|
+
/// and discard the unrequested data in between. This helps reduce the number of API calls
|
|
142
|
+
/// to remote storage services.
|
|
143
|
+
///
|
|
144
|
+
/// This optimization is particularly useful when performing multiple small range reads
|
|
145
|
+
/// that are close to each other, as it reduces the overhead of multiple network requests
|
|
146
|
+
/// at the cost of transferring some additional data.
|
|
147
|
+
///
|
|
148
|
+
/// Refer to [`crate::docs::performance`] for more details.
|
|
149
|
+
pub gap: Option<usize>,
|
|
150
|
+
|
|
151
|
+
/// Specify the content-type header that should be sent back by the operation.
|
|
152
|
+
///
|
|
153
|
+
/// This option is only meaningful when used along with presign.
|
|
154
|
+
pub override_content_type: Option<String>,
|
|
155
|
+
/// Specify the `cache-control` header that should be sent back by the operation.
|
|
156
|
+
///
|
|
157
|
+
/// This option is only meaningful when used along with presign.
|
|
158
|
+
pub override_cache_control: Option<String>,
|
|
159
|
+
/// Specify the `content-disposition` header that should be sent back by the operation.
|
|
160
|
+
///
|
|
161
|
+
/// This option is only meaningful when used along with presign.
|
|
162
|
+
pub override_content_disposition: Option<String>,
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/// Options for reader operations.
|
|
166
|
+
#[derive(Debug, Clone, Default, Eq, PartialEq)]
|
|
167
|
+
pub struct ReaderOptions {
|
|
168
|
+
/// Set `version` for this operation.
|
|
169
|
+
///
|
|
170
|
+
/// This option can be used to retrieve the data of a specified version of the given path.
|
|
171
|
+
///
|
|
172
|
+
/// If the version doesn't exist, an error with kind [`ErrorKind::NotFound`] will be returned.
|
|
173
|
+
pub version: Option<String>,
|
|
174
|
+
|
|
175
|
+
/// Set `if_match` for this operation.
|
|
176
|
+
///
|
|
177
|
+
/// This option can be used to check if the file's `ETag` matches the given `ETag`.
|
|
178
|
+
///
|
|
179
|
+
/// If file exists and it's etag doesn't match, an error with kind [`ErrorKind::ConditionNotMatch`]
|
|
180
|
+
/// will be returned.
|
|
181
|
+
pub if_match: Option<String>,
|
|
182
|
+
/// Set `if_none_match` for this operation.
|
|
183
|
+
///
|
|
184
|
+
/// This option can be used to check if the file's `ETag` doesn't match the given `ETag`.
|
|
185
|
+
///
|
|
186
|
+
/// If file exists and it's etag match, an error with kind [`ErrorKind::ConditionNotMatch`]
|
|
187
|
+
/// will be returned.
|
|
188
|
+
pub if_none_match: Option<String>,
|
|
189
|
+
/// Set `if_modified_since` for this operation.
|
|
190
|
+
///
|
|
191
|
+
/// This option can be used to check if the file has been modified since the given timestamp.
|
|
192
|
+
///
|
|
193
|
+
/// If file exists and it hasn't been modified since the specified time, an error with kind
|
|
194
|
+
/// [`ErrorKind::ConditionNotMatch`] will be returned.
|
|
195
|
+
pub if_modified_since: Option<DateTime<Utc>>,
|
|
196
|
+
/// Set `if_unmodified_since` for this operation.
|
|
197
|
+
///
|
|
198
|
+
/// This feature can be used to check if the file hasn't been modified since the given timestamp.
|
|
199
|
+
///
|
|
200
|
+
/// If file exists and it has been modified since the specified time, an error with kind
|
|
201
|
+
/// [`ErrorKind::ConditionNotMatch`] will be returned.
|
|
202
|
+
pub if_unmodified_since: Option<DateTime<Utc>>,
|
|
203
|
+
|
|
204
|
+
/// Set `concurrent` for the operation.
|
|
205
|
+
///
|
|
206
|
+
/// OpenDAL by default to read file without concurrent. This is not efficient for cases when users
|
|
207
|
+
/// read large chunks of data. By setting `concurrent`, opendal will reading files concurrently
|
|
208
|
+
/// on support storage services.
|
|
209
|
+
///
|
|
210
|
+
/// By setting `concurrent`, opendal will fetch chunks concurrently with
|
|
211
|
+
/// the give chunk size.
|
|
212
|
+
///
|
|
213
|
+
/// Refer to [`crate::docs::performance`] for more details.
|
|
214
|
+
pub concurrent: usize,
|
|
215
|
+
/// Set `chunk` for the operation.
|
|
216
|
+
///
|
|
217
|
+
/// OpenDAL will use services' preferred chunk size by default. Users can set chunk based on their own needs.
|
|
218
|
+
///
|
|
219
|
+
/// Refer to [`crate::docs::performance`] for more details.
|
|
220
|
+
pub chunk: Option<usize>,
|
|
221
|
+
/// Controls the optimization strategy for range reads in [`Reader::fetch`].
|
|
222
|
+
///
|
|
223
|
+
/// When performing range reads, if the gap between two requested ranges is smaller than
|
|
224
|
+
/// the configured `gap` size, OpenDAL will merge these ranges into a single read request
|
|
225
|
+
/// and discard the unrequested data in between. This helps reduce the number of API calls
|
|
226
|
+
/// to remote storage services.
|
|
227
|
+
///
|
|
228
|
+
/// This optimization is particularly useful when performing multiple small range reads
|
|
229
|
+
/// that are close to each other, as it reduces the overhead of multiple network requests
|
|
230
|
+
/// at the cost of transferring some additional data.
|
|
231
|
+
///
|
|
232
|
+
/// Refer to [`crate::docs::performance`] for more details.
|
|
233
|
+
pub gap: Option<usize>,
|
|
234
|
+
/// Controls the number of prefetched bytes ranges that can be buffered in memory
|
|
235
|
+
/// during concurrent reading.
|
|
236
|
+
///
|
|
237
|
+
/// When performing concurrent reads with `Reader`, this option limits how many
|
|
238
|
+
/// completed-but-not-yet-read chunks can be buffered. Once the number of buffered
|
|
239
|
+
/// chunks reaches this limit, no new read tasks will be spawned until some of the
|
|
240
|
+
/// buffered chunks are consumed.
|
|
241
|
+
///
|
|
242
|
+
/// - Default value: 0 (no prefetching, strict back-pressure control)
|
|
243
|
+
/// - Set to a higher value to allow more aggressive prefetching at the cost of memory
|
|
244
|
+
///
|
|
245
|
+
/// This option helps prevent memory exhaustion when reading large files with high
|
|
246
|
+
/// concurrency settings.
|
|
247
|
+
pub prefetch: usize,
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/// Options for stat operations.
|
|
251
|
+
#[derive(Debug, Clone, Default, Eq, PartialEq)]
|
|
252
|
+
pub struct StatOptions {
|
|
253
|
+
/// Set `version` for this operation.
|
|
254
|
+
///
|
|
255
|
+
/// This options can be used to retrieve the data of a specified version of the given path.
|
|
256
|
+
///
|
|
257
|
+
/// If the version doesn't exist, an error with kind [`ErrorKind::NotFound`] will be returned.
|
|
258
|
+
pub version: Option<String>,
|
|
259
|
+
|
|
260
|
+
/// Set `if_match` for this operation.
|
|
261
|
+
///
|
|
262
|
+
/// This option can be used to check if the file's `ETag` matches the given `ETag`.
|
|
263
|
+
///
|
|
264
|
+
/// If file exists and it's etag doesn't match, an error with kind [`ErrorKind::ConditionNotMatch`]
|
|
265
|
+
/// will be returned.
|
|
266
|
+
pub if_match: Option<String>,
|
|
267
|
+
/// Set `if_none_match` for this operation.
|
|
268
|
+
///
|
|
269
|
+
/// This option can be used to check if the file's `ETag` doesn't match the given `ETag`.
|
|
270
|
+
///
|
|
271
|
+
/// If file exists and it's etag match, an error with kind [`ErrorKind::ConditionNotMatch`]
|
|
272
|
+
/// will be returned.
|
|
273
|
+
pub if_none_match: Option<String>,
|
|
274
|
+
/// Set `if_modified_since` for this operation.
|
|
275
|
+
///
|
|
276
|
+
/// This option can be used to check if the file has been modified since the given timestamp.
|
|
277
|
+
///
|
|
278
|
+
/// If file exists and it hasn't been modified since the specified time, an error with kind
|
|
279
|
+
/// [`ErrorKind::ConditionNotMatch`] will be returned.
|
|
280
|
+
pub if_modified_since: Option<DateTime<Utc>>,
|
|
281
|
+
/// Set `if_unmodified_since` for this operation.
|
|
282
|
+
///
|
|
283
|
+
/// This feature can be used to check if the file hasn't been modified since the given timestamp.
|
|
284
|
+
///
|
|
285
|
+
/// If file exists and it has been modified since the specified time, an error with kind
|
|
286
|
+
/// [`ErrorKind::ConditionNotMatch`] will be returned.
|
|
287
|
+
pub if_unmodified_since: Option<DateTime<Utc>>,
|
|
288
|
+
|
|
289
|
+
/// Specify the content-type header that should be sent back by the operation.
|
|
290
|
+
///
|
|
291
|
+
/// This option is only meaningful when used along with presign.
|
|
292
|
+
pub override_content_type: Option<String>,
|
|
293
|
+
/// Specify the `cache-control` header that should be sent back by the operation.
|
|
294
|
+
///
|
|
295
|
+
/// This option is only meaningful when used along with presign.
|
|
296
|
+
pub override_cache_control: Option<String>,
|
|
297
|
+
/// Specify the `content-disposition` header that should be sent back by the operation.
|
|
298
|
+
///
|
|
299
|
+
/// This option is only meaningful when used along with presign.
|
|
300
|
+
pub override_content_disposition: Option<String>,
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/// Options for write operations.
|
|
304
|
+
#[derive(Debug, Clone, Default, Eq, PartialEq)]
|
|
305
|
+
pub struct WriteOptions {
|
|
306
|
+
/// Sets append mode for this operation.
|
|
307
|
+
///
|
|
308
|
+
/// ### Capability
|
|
309
|
+
///
|
|
310
|
+
/// Check [`Capability::write_can_append`] before using this option.
|
|
311
|
+
///
|
|
312
|
+
/// ### Behavior
|
|
313
|
+
///
|
|
314
|
+
/// - By default, write operations overwrite existing files
|
|
315
|
+
/// - When append is set to true:
|
|
316
|
+
/// - New data will be appended to the end of existing file
|
|
317
|
+
/// - If file doesn't exist, it will be created
|
|
318
|
+
/// - If not supported, will return an error
|
|
319
|
+
///
|
|
320
|
+
/// This operation allows adding data to existing files instead of overwriting them.
|
|
321
|
+
pub append: bool,
|
|
322
|
+
|
|
323
|
+
/// Sets Cache-Control header for this write operation.
|
|
324
|
+
///
|
|
325
|
+
/// ### Capability
|
|
326
|
+
///
|
|
327
|
+
/// Check [`Capability::write_with_cache_control`] before using this feature.
|
|
328
|
+
///
|
|
329
|
+
/// ### Behavior
|
|
330
|
+
///
|
|
331
|
+
/// - If supported, sets Cache-Control as system metadata on the target file
|
|
332
|
+
/// - The value should follow HTTP Cache-Control header format
|
|
333
|
+
/// - If not supported, the value will be ignored
|
|
334
|
+
///
|
|
335
|
+
/// This operation allows controlling caching behavior for the written content.
|
|
336
|
+
///
|
|
337
|
+
/// ### Use Cases
|
|
338
|
+
///
|
|
339
|
+
/// - Setting browser cache duration
|
|
340
|
+
/// - Configuring CDN behavior
|
|
341
|
+
/// - Optimizing content delivery
|
|
342
|
+
/// - Managing cache invalidation
|
|
343
|
+
///
|
|
344
|
+
/// ### References
|
|
345
|
+
///
|
|
346
|
+
/// - [MDN Cache-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control)
|
|
347
|
+
/// - [RFC 7234 Section 5.2](https://tools.ietf.org/html/rfc7234#section-5.2)
|
|
348
|
+
pub cache_control: Option<String>,
|
|
349
|
+
/// Sets `Content-Type` header for this write operation.
|
|
350
|
+
///
|
|
351
|
+
/// ## Capability
|
|
352
|
+
///
|
|
353
|
+
/// Check [`Capability::write_with_content_type`] before using this feature.
|
|
354
|
+
///
|
|
355
|
+
/// ### Behavior
|
|
356
|
+
///
|
|
357
|
+
/// - If supported, sets Content-Type as system metadata on the target file
|
|
358
|
+
/// - The value should follow MIME type format (e.g. "text/plain", "image/jpeg")
|
|
359
|
+
/// - If not supported, the value will be ignored
|
|
360
|
+
///
|
|
361
|
+
/// This operation allows specifying the media type of the content being written.
|
|
362
|
+
pub content_type: Option<String>,
|
|
363
|
+
/// Sets Content-Disposition header for this write request.
|
|
364
|
+
///
|
|
365
|
+
/// ### Capability
|
|
366
|
+
///
|
|
367
|
+
/// Check [`Capability::write_with_content_disposition`] before using this feature.
|
|
368
|
+
///
|
|
369
|
+
/// ### Behavior
|
|
370
|
+
///
|
|
371
|
+
/// - If supported, sets Content-Disposition as system metadata on the target file
|
|
372
|
+
/// - The value should follow HTTP Content-Disposition header format
|
|
373
|
+
/// - Common values include:
|
|
374
|
+
/// - `inline` - Content displayed within browser
|
|
375
|
+
/// - `attachment` - Content downloaded as file
|
|
376
|
+
/// - `attachment; filename="example.jpg"` - Downloaded with specified filename
|
|
377
|
+
/// - If not supported, the value will be ignored
|
|
378
|
+
///
|
|
379
|
+
/// This operation allows controlling how the content should be displayed or downloaded.
|
|
380
|
+
pub content_disposition: Option<String>,
|
|
381
|
+
/// Sets Content-Encoding header for this write request.
|
|
382
|
+
///
|
|
383
|
+
/// ### Capability
|
|
384
|
+
///
|
|
385
|
+
/// Check [`Capability::write_with_content_encoding`] before using this feature.
|
|
386
|
+
///
|
|
387
|
+
/// ### Behavior
|
|
388
|
+
///
|
|
389
|
+
/// - If supported, sets Content-Encoding as system metadata on the target file
|
|
390
|
+
/// - The value should follow HTTP Content-Encoding header format
|
|
391
|
+
/// - Common values include:
|
|
392
|
+
/// - `gzip` - Content encoded using gzip compression
|
|
393
|
+
/// - `deflate` - Content encoded using deflate compression
|
|
394
|
+
/// - `br` - Content encoded using Brotli compression
|
|
395
|
+
/// - `identity` - No encoding applied (default value)
|
|
396
|
+
/// - If not supported, the value will be ignored
|
|
397
|
+
///
|
|
398
|
+
/// This operation allows specifying the encoding applied to the content being written.
|
|
399
|
+
pub content_encoding: Option<String>,
|
|
400
|
+
/// Sets user metadata for this write request.
|
|
401
|
+
///
|
|
402
|
+
/// ### Capability
|
|
403
|
+
///
|
|
404
|
+
/// Check [`Capability::write_with_user_metadata`] before using this feature.
|
|
405
|
+
///
|
|
406
|
+
/// ### Behavior
|
|
407
|
+
///
|
|
408
|
+
/// - If supported, the user metadata will be attached to the object during write
|
|
409
|
+
/// - Accepts key-value pairs where both key and value are strings
|
|
410
|
+
/// - Keys are case-insensitive in most services
|
|
411
|
+
/// - Services may have limitations for user metadata, for example:
|
|
412
|
+
/// - Key length is typically limited (e.g., 1024 bytes)
|
|
413
|
+
/// - Value length is typically limited (e.g., 4096 bytes)
|
|
414
|
+
/// - Total metadata size might be limited
|
|
415
|
+
/// - Some characters might be forbidden in keys
|
|
416
|
+
/// - If not supported, the metadata will be ignored
|
|
417
|
+
///
|
|
418
|
+
/// User metadata provides a way to attach custom metadata to objects during write operations.
|
|
419
|
+
/// This metadata can be retrieved later when reading the object.
|
|
420
|
+
pub user_metadata: Option<HashMap<String, String>>,
|
|
421
|
+
|
|
422
|
+
/// Sets If-Match header for this write request.
|
|
423
|
+
///
|
|
424
|
+
/// ### Capability
|
|
425
|
+
///
|
|
426
|
+
/// Check [`Capability::write_with_if_match`] before using this feature.
|
|
427
|
+
///
|
|
428
|
+
/// ### Behavior
|
|
429
|
+
///
|
|
430
|
+
/// - If supported, the write operation will only succeed if the target's ETag matches the specified value
|
|
431
|
+
/// - The value should be a valid ETag string
|
|
432
|
+
/// - Common values include:
|
|
433
|
+
/// - A specific ETag value like `"686897696a7c876b7e"`
|
|
434
|
+
/// - `*` - Matches any existing resource
|
|
435
|
+
/// - If not supported, the value will be ignored
|
|
436
|
+
///
|
|
437
|
+
/// This operation provides conditional write functionality based on ETag matching,
|
|
438
|
+
/// helping prevent unintended overwrites in concurrent scenarios.
|
|
439
|
+
pub if_match: Option<String>,
|
|
440
|
+
/// Sets If-None-Match header for this write request.
|
|
441
|
+
///
|
|
442
|
+
/// Note: Certain services, like `s3`, support `if_not_exists` but not `if_none_match`.
|
|
443
|
+
/// Use `if_not_exists` if you only want to check whether a file exists.
|
|
444
|
+
///
|
|
445
|
+
/// ### Capability
|
|
446
|
+
///
|
|
447
|
+
/// Check [`Capability::write_with_if_none_match`] before using this feature.
|
|
448
|
+
///
|
|
449
|
+
/// ### Behavior
|
|
450
|
+
///
|
|
451
|
+
/// - If supported, the write operation will only succeed if the target's ETag does not match the specified value
|
|
452
|
+
/// - The value should be a valid ETag string
|
|
453
|
+
/// - Common values include:
|
|
454
|
+
/// - A specific ETag value like `"686897696a7c876b7e"`
|
|
455
|
+
/// - `*` - Matches if the resource does not exist
|
|
456
|
+
/// - If not supported, the value will be ignored
|
|
457
|
+
///
|
|
458
|
+
/// This operation provides conditional write functionality based on ETag non-matching,
|
|
459
|
+
/// useful for preventing overwriting existing resources or ensuring unique writes.
|
|
460
|
+
pub if_none_match: Option<String>,
|
|
461
|
+
/// Sets the condition that write operation will succeed only if target does not exist.
|
|
462
|
+
///
|
|
463
|
+
/// ### Capability
|
|
464
|
+
///
|
|
465
|
+
/// Check [`Capability::write_with_if_not_exists`] before using this feature.
|
|
466
|
+
///
|
|
467
|
+
/// ### Behavior
|
|
468
|
+
///
|
|
469
|
+
/// - If supported, the write operation will only succeed if the target path does not exist
|
|
470
|
+
/// - Will return error if target already exists
|
|
471
|
+
/// - If not supported, the value will be ignored
|
|
472
|
+
///
|
|
473
|
+
/// This operation provides a way to ensure write operations only create new resources
|
|
474
|
+
/// without overwriting existing ones, useful for implementing "create if not exists" logic.
|
|
475
|
+
pub if_not_exists: bool,
|
|
476
|
+
|
|
477
|
+
/// Sets concurrent write operations for this writer.
|
|
478
|
+
///
|
|
479
|
+
/// ## Behavior
|
|
480
|
+
///
|
|
481
|
+
/// - By default, OpenDAL writes files sequentially
|
|
482
|
+
/// - When concurrent is set:
|
|
483
|
+
/// - Multiple write operations can execute in parallel
|
|
484
|
+
/// - Write operations return immediately without waiting if tasks space are available
|
|
485
|
+
/// - Close operation ensures all writes complete in order
|
|
486
|
+
/// - Memory usage increases with concurrency level
|
|
487
|
+
/// - If not supported, falls back to sequential writes
|
|
488
|
+
///
|
|
489
|
+
/// This feature significantly improves performance when:
|
|
490
|
+
/// - Writing large files
|
|
491
|
+
/// - Network latency is high
|
|
492
|
+
/// - Storage service supports concurrent uploads like multipart uploads
|
|
493
|
+
///
|
|
494
|
+
/// ## Performance Impact
|
|
495
|
+
///
|
|
496
|
+
/// Setting appropriate concurrency can:
|
|
497
|
+
/// - Increase write throughput
|
|
498
|
+
/// - Reduce total write time
|
|
499
|
+
/// - Better utilize available bandwidth
|
|
500
|
+
/// - Trade memory for performance
|
|
501
|
+
pub concurrent: usize,
|
|
502
|
+
/// Sets chunk size for buffered writes.
|
|
503
|
+
///
|
|
504
|
+
/// ### Capability
|
|
505
|
+
///
|
|
506
|
+
/// Check [`Capability::write_multi_min_size`] and [`Capability::write_multi_max_size`] for size limits.
|
|
507
|
+
///
|
|
508
|
+
/// ### Behavior
|
|
509
|
+
///
|
|
510
|
+
/// - By default, OpenDAL sets optimal chunk size based on service capabilities
|
|
511
|
+
/// - When chunk size is set:
|
|
512
|
+
/// - Data will be buffered until reaching chunk size
|
|
513
|
+
/// - One API call will be made per chunk
|
|
514
|
+
/// - Last chunk may be smaller than chunk size
|
|
515
|
+
/// - Important considerations:
|
|
516
|
+
/// - Some services require minimum chunk sizes (e.g. S3's EntityTooSmall error)
|
|
517
|
+
/// - Smaller chunks increase API calls and costs
|
|
518
|
+
/// - Larger chunks increase memory usage, but improve performance and reduce costs
|
|
519
|
+
///
|
|
520
|
+
/// ### Performance Impact
|
|
521
|
+
///
|
|
522
|
+
/// Setting appropriate chunk size can:
|
|
523
|
+
/// - Reduce number of API calls
|
|
524
|
+
/// - Improve overall throughput
|
|
525
|
+
/// - Lower operation costs
|
|
526
|
+
/// - Better utilize network bandwidth
|
|
527
|
+
pub chunk: Option<usize>,
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/// Options for copy operations.
|
|
531
|
+
#[derive(Debug, Clone, Default, Eq, PartialEq)]
|
|
532
|
+
pub struct CopyOptions {
|
|
533
|
+
/// Sets the condition that copy operation will succeed only if target does not exist.
|
|
534
|
+
///
|
|
535
|
+
/// ### Capability
|
|
536
|
+
///
|
|
537
|
+
/// Check [`Capability::copy_with_if_not_exists`] before using this feature.
|
|
538
|
+
///
|
|
539
|
+
/// ### Behavior
|
|
540
|
+
///
|
|
541
|
+
/// - If supported, the copy operation will only succeed if the target path does not exist
|
|
542
|
+
/// - Will return error if target already exists
|
|
543
|
+
/// - If not supported, the value will be ignored
|
|
544
|
+
///
|
|
545
|
+
/// This operation provides a way to ensure copy operations only create new resources
|
|
546
|
+
/// without overwriting existing ones, useful for implementing "copy if not exists" logic.
|
|
547
|
+
pub if_not_exists: bool,
|
|
548
|
+
}
|