This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 3eb5cd99b refactor: Register services only in opendal (#7093)
3eb5cd99b is described below
commit 3eb5cd99b3f48c8ced4cf683264f1c16f363ee4a
Author: Xuanwo <[email protected]>
AuthorDate: Thu Dec 25 10:32:13 2025 +0800
refactor: Register services only in opendal (#7093)
* refactor: Register services only in opendal
* refactor
* refactor(services): Export per-service register fns
* fix(core): Avoid tests module name clash
* Fix build
* fix(bindings/cpp): Honor FEATURES as alias
* Revert "fix(bindings/cpp): Honor FEATURES as alias"
This reverts commit b79ca4a33b8984c773c18cb71b4c1bf464764991.
* fix(core): Add init_default_registry for staticlib bindings
* init in c
* Already enable memory
---
bindings/c/src/operator.rs | 2 +
bindings/cpp/src/async.rs | 2 +
bindings/cpp/src/lib.rs | 2 +
core/Cargo.lock | 63 +--------
core/Cargo.toml | 3 +-
core/core/Cargo.toml | 4 +-
core/core/src/docs/rfcs/6828_core.md | 2 +-
core/core/src/services/memory/mod.rs | 8 +-
core/core/src/services/mod.rs | 2 -
core/core/src/types/operator/registry.rs | 16 ++-
core/services/aliyun-drive/Cargo.toml | 1 -
core/services/aliyun-drive/src/lib.rs | 10 +-
core/services/alluxio/Cargo.toml | 1 -
core/services/alluxio/src/lib.rs | 10 +-
core/services/azblob/Cargo.toml | 1 -
core/services/azblob/src/lib.rs | 10 +-
core/services/azdls/Cargo.toml | 1 -
core/services/azdls/src/lib.rs | 10 +-
core/services/azfile/Cargo.toml | 1 -
core/services/azfile/src/lib.rs | 10 +-
core/services/b2/Cargo.toml | 1 -
core/services/b2/src/lib.rs | 10 +-
core/services/cacache/Cargo.toml | 1 -
core/services/cacache/src/lib.rs | 6 +-
core/services/cloudflare-kv/Cargo.toml | 1 -
core/services/cloudflare-kv/src/lib.rs | 6 +-
core/services/compfs/Cargo.toml | 1 -
core/services/compfs/src/lib.rs | 6 +-
core/services/cos/Cargo.toml | 1 -
core/services/cos/src/lib.rs | 10 +-
core/services/d1/Cargo.toml | 1 -
core/services/d1/src/lib.rs | 6 +-
core/services/dashmap/Cargo.toml | 1 -
core/services/dashmap/src/lib.rs | 6 +-
core/services/dbfs/Cargo.toml | 1 -
core/services/dbfs/src/lib.rs | 6 +-
core/services/dropbox/Cargo.toml | 1 -
core/services/dropbox/src/lib.rs | 6 +-
core/services/etcd/Cargo.toml | 1 -
core/services/etcd/src/lib.rs | 6 +-
core/services/foundationdb/Cargo.toml | 1 -
core/services/foundationdb/src/lib.rs | 6 +-
core/services/fs/Cargo.toml | 1 -
core/services/fs/src/lib.rs | 9 +-
core/services/ftp/Cargo.toml | 1 -
core/services/ftp/src/lib.rs | 10 +-
core/services/gcs/Cargo.toml | 1 -
core/services/gcs/src/lib.rs | 6 +-
core/services/gdrive/Cargo.toml | 1 -
core/services/gdrive/src/lib.rs | 10 +-
core/services/ghac/Cargo.toml | 1 -
core/services/ghac/src/lib.rs | 10 +-
core/services/github/Cargo.toml | 1 -
core/services/github/src/lib.rs | 10 +-
core/services/github/src/mod.rs | 6 -
core/services/gridfs/Cargo.toml | 1 -
core/services/gridfs/src/lib.rs | 6 +-
core/services/hdfs-native/Cargo.toml | 1 -
core/services/hdfs-native/src/lib.rs | 10 +-
core/services/hdfs/Cargo.toml | 1 -
core/services/hdfs/src/lib.rs | 10 +-
core/services/http/Cargo.toml | 1 -
core/services/http/src/lib.rs | 6 +-
core/services/huggingface/Cargo.toml | 1 -
core/services/huggingface/src/lib.rs | 10 +-
core/services/ipfs/Cargo.toml | 1 -
core/services/ipfs/src/lib.rs | 6 +-
core/services/ipmfs/Cargo.toml | 1 -
core/services/ipmfs/src/lib.rs | 10 +-
core/services/koofr/Cargo.toml | 1 -
core/services/koofr/src/lib.rs | 10 +-
core/services/lakefs/Cargo.toml | 1 -
core/services/lakefs/src/lib.rs | 6 +-
core/services/memcached/Cargo.toml | 1 -
core/services/memcached/src/lib.rs | 6 +-
core/services/mini_moka/Cargo.toml | 1 -
core/services/mini_moka/src/lib.rs | 6 +-
core/services/moka/Cargo.toml | 1 -
core/services/moka/src/lib.rs | 6 +-
core/services/mongodb/Cargo.toml | 1 -
core/services/mongodb/src/lib.rs | 10 +-
core/services/monoiofs/Cargo.toml | 1 -
core/services/monoiofs/src/lib.rs | 6 +-
core/services/mysql/Cargo.toml | 1 -
core/services/mysql/src/lib.rs | 10 +-
core/services/obs/Cargo.toml | 1 -
core/services/obs/src/lib.rs | 10 +-
core/services/onedrive/Cargo.toml | 1 -
core/services/onedrive/src/lib.rs | 6 +-
core/services/opfs/Cargo.toml | 1 -
core/services/opfs/src/lib.rs | 10 +-
core/services/oss/Cargo.toml | 1 -
core/services/oss/src/lib.rs | 6 +-
core/services/pcloud/Cargo.toml | 1 -
core/services/pcloud/src/lib.rs | 6 +-
core/services/persy/Cargo.toml | 1 -
core/services/persy/src/lib.rs | 6 +-
core/services/postgresql/Cargo.toml | 1 -
core/services/postgresql/src/lib.rs | 10 +-
core/services/redb/Cargo.toml | 1 -
core/services/redb/src/lib.rs | 6 +-
core/services/redis/Cargo.toml | 1 -
core/services/redis/src/lib.rs | 6 +-
core/services/rocksdb/Cargo.toml | 1 -
core/services/rocksdb/src/lib.rs | 10 +-
core/services/s3/Cargo.toml | 1 -
core/services/s3/src/lib.rs | 6 +-
core/services/s3/src/mod.rs | 6 -
core/services/seafile/Cargo.toml | 1 -
core/services/seafile/src/lib.rs | 10 +-
core/services/sftp/Cargo.toml | 1 -
core/services/sftp/src/lib.rs | 6 +-
core/services/sled/Cargo.toml | 1 -
core/services/sled/src/lib.rs | 10 +-
core/services/sqlite/Cargo.toml | 1 -
core/services/sqlite/src/lib.rs | 10 +-
core/services/surrealdb/Cargo.toml | 1 -
core/services/surrealdb/src/lib.rs | 6 +-
core/services/swift/Cargo.toml | 1 -
core/services/swift/src/lib.rs | 8 +-
core/services/tikv/Cargo.toml | 1 -
core/services/tikv/src/lib.rs | 10 +-
core/services/upyun/Cargo.toml | 1 -
core/services/upyun/src/lib.rs | 6 +-
core/services/vercel-artifacts/Cargo.toml | 1 -
core/services/vercel-artifacts/src/lib.rs | 10 +-
core/services/vercel-blob/Cargo.toml | 1 -
core/services/vercel-blob/src/lib.rs | 10 +-
core/services/webdav/Cargo.toml | 1 -
core/services/webdav/src/lib.rs | 10 +-
core/services/webhdfs/Cargo.toml | 1 -
core/services/webhdfs/src/lib.rs | 10 +-
core/services/yandex-disk/Cargo.toml | 1 -
core/services/yandex-disk/src/lib.rs | 6 +-
core/src/lib.rs | 214 +++++++++++++++++++++++++++++-
135 files changed, 455 insertions(+), 427 deletions(-)
diff --git a/bindings/c/src/operator.rs b/bindings/c/src/operator.rs
index df2e65dea..428ce4439 100644
--- a/bindings/c/src/operator.rs
+++ b/bindings/c/src/operator.rs
@@ -88,6 +88,8 @@ fn build_operator(
schema: &str,
map: HashMap<String, String>,
) -> core::Result<core::blocking::Operator> {
+ core::init_default_registry();
+
let op = core::Operator::via_iter(schema,
map)?.layer(core::layers::RetryLayer::new());
let runtime =
diff --git a/bindings/cpp/src/async.rs b/bindings/cpp/src/async.rs
index 29038589c..a743dd5f5 100644
--- a/bindings/cpp/src/async.rs
+++ b/bindings/cpp/src/async.rs
@@ -152,6 +152,8 @@ fn new_operator(scheme: &str, configs:
Vec<ffi::HashMapValue>) -> Result<Box<Ope
.map(|value| (value.key, value.value))
.collect();
+ od::init_default_registry();
+
let op = Box::new(Operator(od::Operator::via_iter(scheme, map)?));
Ok(op)
diff --git a/bindings/cpp/src/lib.rs b/bindings/cpp/src/lib.rs
index ae05423b3..db71710ea 100644
--- a/bindings/cpp/src/lib.rs
+++ b/bindings/cpp/src/lib.rs
@@ -165,6 +165,8 @@ fn new_operator(scheme: &str, configs:
Vec<ffi::HashMapValue>) -> Result<*mut Op
.map(|value| (value.key, value.value))
.collect();
+ od::init_default_registry();
+
let runtime =
tokio::runtime::Handle::try_current().unwrap_or_else(|_|
RUNTIME.handle().clone());
let _guard = runtime.enter();
diff --git a/core/Cargo.lock b/core/Cargo.lock
index 852e81b01..a9e83990c 100644
--- a/core/Cargo.lock
+++ b/core/Cargo.lock
@@ -5539,6 +5539,7 @@ version = "0.55.0"
dependencies = [
"anyhow",
"bytes",
+ "ctor",
"divan",
"futures",
"http 1.4.0",
@@ -5672,7 +5673,6 @@ dependencies = [
"anyhow",
"base64 0.22.1",
"bytes",
- "ctor",
"futures",
"http 1.4.0",
"http-body 1.0.1",
@@ -5968,7 +5968,6 @@ name = "opendal-service-aliyun-drive"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"mea",
@@ -5983,7 +5982,6 @@ name = "opendal-service-alluxio"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -5998,7 +5996,6 @@ version = "0.55.0"
dependencies = [
"base64 0.22.1",
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6018,7 +6015,6 @@ name = "opendal-service-azdls"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6035,7 +6031,6 @@ name = "opendal-service-azfile"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6060,7 +6055,6 @@ name = "opendal-service-b2"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"mea",
@@ -6076,7 +6070,6 @@ version = "0.55.0"
dependencies = [
"bytes",
"cacache",
- "ctor",
"opendal-core",
"serde",
"tokio",
@@ -6087,7 +6080,6 @@ name = "opendal-service-cloudflare-kv"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"opendal-core",
"serde",
@@ -6100,7 +6092,6 @@ version = "0.55.0"
dependencies = [
"bytes",
"compio",
- "ctor",
"opendal-core",
"rand 0.8.5",
"serde",
@@ -6111,7 +6102,6 @@ name = "opendal-service-cos"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6127,7 +6117,6 @@ name = "opendal-service-d1"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"opendal-core",
"serde",
@@ -6139,7 +6128,6 @@ dependencies = [
name = "opendal-service-dashmap"
version = "0.55.0"
dependencies = [
- "ctor",
"dashmap 6.1.0",
"log",
"opendal-core",
@@ -6153,7 +6141,6 @@ version = "0.55.0"
dependencies = [
"base64 0.22.1",
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6167,7 +6154,6 @@ name = "opendal-service-dropbox"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"mea",
"opendal-core",
@@ -6180,7 +6166,6 @@ dependencies = [
name = "opendal-service-etcd"
version = "0.55.0"
dependencies = [
- "ctor",
"etcd-client",
"fastpool",
"opendal-core",
@@ -6192,7 +6177,6 @@ dependencies = [
name = "opendal-service-foundationdb"
version = "0.55.0"
dependencies = [
- "ctor",
"foundationdb",
"opendal-core",
"serde",
@@ -6204,7 +6188,6 @@ name = "opendal-service-fs"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"log",
"opendal-core",
"serde",
@@ -6217,7 +6200,6 @@ name = "opendal-service-ftp"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"fastpool",
"futures",
"futures-rustls",
@@ -6236,7 +6218,6 @@ version = "0.55.0"
dependencies = [
"backon",
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6254,7 +6235,6 @@ name = "opendal-service-gdrive"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"mea",
@@ -6269,7 +6249,6 @@ name = "opendal-service-ghac"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"ghac",
"http 1.4.0",
"log",
@@ -6289,7 +6268,6 @@ version = "0.55.0"
dependencies = [
"base64 0.22.1",
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6302,7 +6280,6 @@ dependencies = [
name = "opendal-service-gridfs"
version = "0.55.0"
dependencies = [
- "ctor",
"futures",
"mea",
"mongodb",
@@ -6316,7 +6293,6 @@ name = "opendal-service-hdfs"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"futures",
"hdrs",
"log",
@@ -6330,7 +6306,6 @@ name = "opendal-service-hdfs-native"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"futures",
"hdfs-native",
"log",
@@ -6342,7 +6317,6 @@ dependencies = [
name = "opendal-service-http"
version = "0.55.0"
dependencies = [
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6355,7 +6329,6 @@ name = "opendal-service-huggingface"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"futures",
"http 1.4.0",
"log",
@@ -6371,7 +6344,6 @@ name = "opendal-service-ipfs"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6385,7 +6357,6 @@ name = "opendal-service-ipmfs"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6399,7 +6370,6 @@ name = "opendal-service-koofr"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"mea",
@@ -6414,7 +6384,6 @@ name = "opendal-service-lakefs"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6427,7 +6396,6 @@ dependencies = [
name = "opendal-service-memcached"
version = "0.55.0"
dependencies = [
- "ctor",
"fastpool",
"http 1.4.0",
"opendal-core",
@@ -6439,7 +6407,6 @@ dependencies = [
name = "opendal-service-mini-moka"
version = "0.55.0"
dependencies = [
- "ctor",
"log",
"mini-moka",
"opendal-core",
@@ -6450,7 +6417,6 @@ dependencies = [
name = "opendal-service-moka"
version = "0.55.0"
dependencies = [
- "ctor",
"log",
"moka",
"opendal-core",
@@ -6463,7 +6429,6 @@ name = "opendal-service-mongodb"
version = "0.55.0"
dependencies = [
"anyhow",
- "ctor",
"mea",
"mongodb",
"opendal-core",
@@ -6476,7 +6441,6 @@ name = "opendal-service-monoiofs"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"flume",
"futures",
"monoio",
@@ -6489,7 +6453,6 @@ dependencies = [
name = "opendal-service-mysql"
version = "0.55.0"
dependencies = [
- "ctor",
"mea",
"opendal-core",
"serde",
@@ -6502,7 +6465,6 @@ name = "opendal-service-obs"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6517,7 +6479,6 @@ name = "opendal-service-onedrive"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"mea",
@@ -6531,7 +6492,6 @@ dependencies = [
name = "opendal-service-opfs"
version = "0.55.0"
dependencies = [
- "ctor",
"js-sys",
"opendal-core",
"serde",
@@ -6545,7 +6505,6 @@ name = "opendal-service-oss"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6561,7 +6520,6 @@ name = "opendal-service-pcloud"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6574,7 +6532,6 @@ dependencies = [
name = "opendal-service-persy"
version = "0.55.0"
dependencies = [
- "ctor",
"opendal-core",
"persy",
"serde",
@@ -6585,7 +6542,6 @@ dependencies = [
name = "opendal-service-postgresql"
version = "0.55.0"
dependencies = [
- "ctor",
"mea",
"opendal-core",
"serde",
@@ -6597,7 +6553,6 @@ dependencies = [
name = "opendal-service-redb"
version = "0.55.0"
dependencies = [
- "ctor",
"opendal-core",
"redb",
"serde",
@@ -6609,7 +6564,6 @@ name = "opendal-service-redis"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"fastpool",
"http 1.4.0",
"opendal-core",
@@ -6622,7 +6576,6 @@ dependencies = [
name = "opendal-service-rocksdb"
version = "0.55.0"
dependencies = [
- "ctor",
"opendal-core",
"rocksdb",
"serde",
@@ -6636,7 +6589,6 @@ dependencies = [
"base64 0.22.1",
"bytes",
"crc32c",
- "ctor",
"http 1.4.0",
"log",
"md-5",
@@ -6659,7 +6611,6 @@ name = "opendal-service-seafile"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"mea",
@@ -6675,7 +6626,6 @@ version = "0.55.0"
dependencies = [
"anyhow",
"bytes",
- "ctor",
"fastpool",
"futures",
"log",
@@ -6690,7 +6640,6 @@ dependencies = [
name = "opendal-service-sled"
version = "0.55.0"
dependencies = [
- "ctor",
"opendal-core",
"serde",
"sled",
@@ -6701,7 +6650,6 @@ dependencies = [
name = "opendal-service-sqlite"
version = "0.55.0"
dependencies = [
- "ctor",
"mea",
"opendal-core",
"serde",
@@ -6713,7 +6661,6 @@ dependencies = [
name = "opendal-service-surrealdb"
version = "0.55.0"
dependencies = [
- "ctor",
"mea",
"opendal-core",
"serde",
@@ -6726,7 +6673,6 @@ name = "opendal-service-swift"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6740,7 +6686,6 @@ dependencies = [
name = "opendal-service-tikv"
version = "0.55.0"
dependencies = [
- "ctor",
"mea",
"opendal-core",
"serde",
@@ -6754,7 +6699,6 @@ version = "0.55.0"
dependencies = [
"base64 0.22.1",
"bytes",
- "ctor",
"hmac",
"http 1.4.0",
"log",
@@ -6773,7 +6717,6 @@ version = "0.55.0"
dependencies = [
"anyhow",
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6787,7 +6730,6 @@ name = "opendal-service-vercel-blob"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
@@ -6803,7 +6745,6 @@ version = "0.55.0"
dependencies = [
"anyhow",
"bytes",
- "ctor",
"http 1.4.0",
"log",
"mea",
@@ -6819,7 +6760,6 @@ version = "0.55.0"
dependencies = [
"anyhow",
"bytes",
- "ctor",
"http 1.4.0",
"log",
"mea",
@@ -6835,7 +6775,6 @@ name = "opendal-service-yandex-disk"
version = "0.55.0"
dependencies = [
"bytes",
- "ctor",
"http 1.4.0",
"log",
"opendal-core",
diff --git a/core/Cargo.toml b/core/Cargo.toml
index f3f58c972..013261659 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -86,7 +86,6 @@ default = [
"layers-logging",
"layers-retry",
"layers-timeout",
- "services-memory",
]
executors-tokio = ["opendal-core/executors-tokio"]
internal-path-cache = ["opendal-core/internal-path-cache"]
@@ -146,6 +145,7 @@ services-ipmfs = ["dep:opendal-service-ipmfs"]
services-koofr = ["dep:opendal-service-koofr"]
services-lakefs = ["dep:opendal-service-lakefs"]
services-memcached = ["dep:opendal-service-memcached"]
+# Deprecated: memory service is always enabled.
services-memory = ["opendal-core/services-memory"]
services-mini-moka = ["dep:opendal-service-mini-moka"]
services-moka = ["dep:opendal-service-moka"]
@@ -201,6 +201,7 @@ path = "tests/behavior/main.rs"
required-features = ["tests"]
[dependencies]
+ctor = { workspace = true }
opendal-core = { path = "core", version = "0.55.0", default-features = false }
opendal-layer-async-backtrace = { path = "layers/async-backtrace", version =
"0.55.0", optional = true, default-features = false }
opendal-layer-await-tree = { path = "layers/await-tree", version = "0.55.0",
optional = true, default-features = false }
diff --git a/core/core/Cargo.toml b/core/core/Cargo.toml
index 650628588..ffebc980d 100644
--- a/core/core/Cargo.toml
+++ b/core/core/Cargo.toml
@@ -37,7 +37,7 @@ unused_async = "warn"
all-features = true
[features]
-default = ["reqwest-rustls-tls", "executors-tokio", "services-memory"]
+default = ["reqwest-rustls-tls", "executors-tokio"]
# Enable reqwest rustls tls support.
reqwest-rustls-tls = ["reqwest/rustls-tls"]
@@ -54,6 +54,7 @@ internal-tokio-rt = ["tokio/rt-multi-thread"]
# Enable tokio executors support.
executors-tokio = ["tokio/rt"]
+# Deprecated: memory service is always enabled.
services-memory = []
[lib]
@@ -65,7 +66,6 @@ doctest = false
anyhow = { version = "1.0.100", features = ["std"] }
base64 = { workspace = true }
bytes = { workspace = true }
-ctor = { workspace = true }
futures = { workspace = true, features = ["std", "async-await"] }
http = { workspace = true }
http-body = "1"
diff --git a/core/core/src/docs/rfcs/6828_core.md
b/core/core/src/docs/rfcs/6828_core.md
index 2ef54a627..764bcc352 100644
--- a/core/core/src/docs/rfcs/6828_core.md
+++ b/core/core/src/docs/rfcs/6828_core.md
@@ -50,7 +50,7 @@ opendal = { version = "0.56", features = ["service-s3",
"layer-logging"] }
- `opendal` facade
- Depends on `opendal-core` (mandatory), `opendal-layer-*` and
`opendal-service-*` as optional deps behind features.
- Re-exports `core::{Operator, Result, ...}`, critical layers, and optional
services/layers.
- - On build, each enabled service self-registers via a `ctor` initializer to
populate `DEFAULT_OPERATOR_REGISTRY`.
+ - On build, the facade crate registers enabled services via a single `ctor`
initializer to populate `DEFAULT_OPERATOR_REGISTRY`.
- Maintains feature aliases for one major version (e.g., `services-s3` ->
`service-s3`, `layers-logging` -> `layer-logging`).
## Feature matrix
diff --git a/core/core/src/services/memory/mod.rs
b/core/core/src/services/memory/mod.rs
index 80a0bf3da..9937e14cb 100644
--- a/core/core/src/services/memory/mod.rs
+++ b/core/core/src/services/memory/mod.rs
@@ -18,8 +18,6 @@
/// Default scheme for memory service.
pub const MEMORY_SCHEME: &str = "memory";
-use crate::types::DEFAULT_OPERATOR_REGISTRY;
-
mod backend;
mod config;
mod core;
@@ -30,7 +28,7 @@ mod writer;
pub use backend::MemoryBuilder as Memory;
pub use config::MemoryConfig;
-#[ctor::ctor]
-fn register_memory_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Memory>(MEMORY_SCHEME);
+/// Register this service into the given registry.
+pub fn register_memory_service(registry: &crate::OperatorRegistry) {
+ registry.register::<Memory>(MEMORY_SCHEME);
}
diff --git a/core/core/src/services/mod.rs b/core/core/src/services/mod.rs
index f7c8457e0..64de2dc29 100644
--- a/core/core/src/services/mod.rs
+++ b/core/core/src/services/mod.rs
@@ -19,7 +19,5 @@
//!
//! More ongoing services support is tracked at
[opendal#5](https://github.com/apache/opendal/issues/5). Please feel free to
submit issues if there are services not covered.
-#[cfg(feature = "services-memory")]
mod memory;
-#[cfg(feature = "services-memory")]
pub use self::memory::*;
diff --git a/core/core/src/types/operator/registry.rs
b/core/core/src/types/operator/registry.rs
index 8afeee43f..dc10beb5e 100644
--- a/core/core/src/types/operator/registry.rs
+++ b/core/core/src/types/operator/registry.rs
@@ -25,9 +25,19 @@ use crate::{Error, ErrorKind, Operator, Result};
/// Factory signature used to construct [`Operator`] from a URI and extra
options.
pub type OperatorFactory = fn(&OperatorUri) -> Result<Operator>;
-/// Default registry initialized with builtin services.
-pub static DEFAULT_OPERATOR_REGISTRY: LazyLock<OperatorRegistry> =
- LazyLock::new(OperatorRegistry::new);
+/// Default registry used by [`Operator::from_uri`].
+///
+/// `memory` is always registered here since it's used pervasively in unit
tests
+/// and as a zero-dependency backend.
+///
+/// Other optional service registrations are handled by the facade crate
`opendal`.
+pub static DEFAULT_OPERATOR_REGISTRY: LazyLock<OperatorRegistry> =
LazyLock::new(|| {
+ let registry = OperatorRegistry::new();
+
+ crate::services::register_memory_service(®istry);
+
+ registry
+});
/// Global registry that maps schemes to [`OperatorFactory`] functions.
#[derive(Debug, Default)]
diff --git a/core/services/aliyun-drive/Cargo.toml
b/core/services/aliyun-drive/Cargo.toml
index 30d3a5790..bbf424b1a 100644
--- a/core/services/aliyun-drive/Cargo.toml
+++ b/core/services/aliyun-drive/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
mea = "0.5.1"
diff --git a/core/services/aliyun-drive/src/lib.rs
b/core/services/aliyun-drive/src/lib.rs
index a70d37719..1ef2ae9c5 100644
--- a/core/services/aliyun-drive/src/lib.rs
+++ b/core/services/aliyun-drive/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for aliyun-drive service.
pub const ALIYUN_DRIVE_SCHEME: &str = "aliyun-drive";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_aliyun_drive_service(registry:
&opendal_core::OperatorRegistry) {
+ registry.register::<AliyunDrive>(ALIYUN_DRIVE_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::AliyunDriveBuilder as AliyunDrive;
pub use config::AliyunDriveConfig;
-
-#[ctor::ctor]
-fn register_aliyun_drive_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<AliyunDrive>(ALIYUN_DRIVE_SCHEME);
-}
diff --git a/core/services/alluxio/Cargo.toml b/core/services/alluxio/Cargo.toml
index 323f4a128..0c786de9b 100644
--- a/core/services/alluxio/Cargo.toml
+++ b/core/services/alluxio/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/alluxio/src/lib.rs b/core/services/alluxio/src/lib.rs
index 29908c174..abd15edf8 100644
--- a/core/services/alluxio/src/lib.rs
+++ b/core/services/alluxio/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for alluxio service.
pub const ALLUXIO_SCHEME: &str = "alluxio";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_alluxio_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Alluxio>(ALLUXIO_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::AlluxioBuilder as Alluxio;
pub use config::AlluxioConfig;
-
-#[ctor::ctor]
-fn register_alluxio_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Alluxio>(ALLUXIO_SCHEME);
-}
diff --git a/core/services/azblob/Cargo.toml b/core/services/azblob/Cargo.toml
index 0f617e2eb..87274adf4 100644
--- a/core/services/azblob/Cargo.toml
+++ b/core/services/azblob/Cargo.toml
@@ -33,7 +33,6 @@ all-features = true
[dependencies]
base64 = { workspace = true }
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/azblob/src/lib.rs b/core/services/azblob/src/lib.rs
index 69fdf9d88..6656b55c3 100644
--- a/core/services/azblob/src/lib.rs
+++ b/core/services/azblob/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for azblob service.
pub const AZBLOB_SCHEME: &str = "azblob";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_azblob_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Azblob>(AZBLOB_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ pub mod writer;
pub use backend::AzblobBuilder as Azblob;
pub use config::AzblobConfig;
-
-#[ctor::ctor]
-fn register_azblob_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Azblob>(AZBLOB_SCHEME);
-}
diff --git a/core/services/azdls/Cargo.toml b/core/services/azdls/Cargo.toml
index 222f0dd85..820594838 100644
--- a/core/services/azdls/Cargo.toml
+++ b/core/services/azdls/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/azdls/src/lib.rs b/core/services/azdls/src/lib.rs
index 9c139e977..f68a34d05 100644
--- a/core/services/azdls/src/lib.rs
+++ b/core/services/azdls/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for azdls service.
pub const AZDLS_SCHEME: &str = "azdls";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_azdls_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Azdls>(AZDLS_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::AzdlsBuilder as Azdls;
pub use config::AzdlsConfig;
-
-#[ctor::ctor]
-fn register_azdls_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Azdls>(AZDLS_SCHEME);
-}
diff --git a/core/services/azfile/Cargo.toml b/core/services/azfile/Cargo.toml
index 45e67b993..4741324dc 100644
--- a/core/services/azfile/Cargo.toml
+++ b/core/services/azfile/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/azfile/src/lib.rs b/core/services/azfile/src/lib.rs
index ea3f41abf..1cc8b9b98 100644
--- a/core/services/azfile/src/lib.rs
+++ b/core/services/azfile/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for azfile service.
pub const AZFILE_SCHEME: &str = "azfile";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_azfile_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Azfile>(AZFILE_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::AzfileBuilder as Azfile;
pub use config::AzfileConfig;
-
-#[ctor::ctor]
-fn register_azfile_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Azfile>(AZFILE_SCHEME);
-}
diff --git a/core/services/b2/Cargo.toml b/core/services/b2/Cargo.toml
index 68b552b80..46222a85f 100644
--- a/core/services/b2/Cargo.toml
+++ b/core/services/b2/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
mea = "0.5.1"
diff --git a/core/services/b2/src/lib.rs b/core/services/b2/src/lib.rs
index 76ac1d363..d65654215 100644
--- a/core/services/b2/src/lib.rs
+++ b/core/services/b2/src/lib.rs
@@ -22,7 +22,10 @@
/// Default scheme for b2 service.
pub const B2_SCHEME: &str = "b2";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_b2_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<B2>(B2_SCHEME);
+}
mod backend;
mod config;
@@ -34,8 +37,3 @@ mod writer;
pub use backend::B2Builder as B2;
pub use config::B2Config;
-
-#[ctor::ctor]
-fn register_b2_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<B2>(B2_SCHEME);
-}
diff --git a/core/services/cacache/Cargo.toml b/core/services/cacache/Cargo.toml
index 3f3f0bbd1..fdd26b52b 100644
--- a/core/services/cacache/Cargo.toml
+++ b/core/services/cacache/Cargo.toml
@@ -36,7 +36,6 @@ cacache = { version = "13.0", default-features = false,
features = [
"tokio-runtime",
"mmap",
] }
-ctor = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/cacache/src/lib.rs b/core/services/cacache/src/lib.rs
index 92c48600f..71a4b941f 100644
--- a/core/services/cacache/src/lib.rs
+++ b/core/services/cacache/src/lib.rs
@@ -32,7 +32,7 @@ pub use config::CacacheConfig;
/// Default scheme for cacache service.
pub const CACACHE_SCHEME: &str = "cacache";
-#[ctor::ctor]
-fn register_cacache_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Cacache>(CACACHE_SCHEME);
+/// Register this service into the given registry.
+pub fn register_cacache_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Cacache>(CACACHE_SCHEME);
}
diff --git a/core/services/cloudflare-kv/Cargo.toml
b/core/services/cloudflare-kv/Cargo.toml
index 0d8999e99..3a886dddd 100644
--- a/core/services/cloudflare-kv/Cargo.toml
+++ b/core/services/cloudflare-kv/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/cloudflare-kv/src/lib.rs
b/core/services/cloudflare-kv/src/lib.rs
index fc0d489e0..ec2ba6dc1 100644
--- a/core/services/cloudflare-kv/src/lib.rs
+++ b/core/services/cloudflare-kv/src/lib.rs
@@ -34,7 +34,7 @@ pub use config::CloudflareKvConfig;
/// Default scheme for cloudflare-kv service.
pub const CLOUDFLARE_KV_SCHEME: &str = "cloudflare-kv";
-#[ctor::ctor]
-fn register_cloudflare_kv_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<CloudflareKv>(CLOUDFLARE_KV_SCHEME);
+/// Register this service into the given registry.
+pub fn register_cloudflare_kv_service(registry:
&opendal_core::OperatorRegistry) {
+ registry.register::<CloudflareKv>(CLOUDFLARE_KV_SCHEME);
}
diff --git a/core/services/compfs/Cargo.toml b/core/services/compfs/Cargo.toml
index 44992f821..0e42deed0 100644
--- a/core/services/compfs/Cargo.toml
+++ b/core/services/compfs/Cargo.toml
@@ -37,7 +37,6 @@ compio = { version = "0.16.0", features = [
"polling",
"dispatcher",
] }
-ctor = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/compfs/src/lib.rs b/core/services/compfs/src/lib.rs
index afa7a90b7..31f943ab5 100644
--- a/core/services/compfs/src/lib.rs
+++ b/core/services/compfs/src/lib.rs
@@ -33,7 +33,7 @@ pub use config::CompfsConfig;
/// Default scheme for compfs service.
pub const COMPFS_SCHEME: &str = "compfs";
-#[ctor::ctor]
-fn register_compfs_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Compfs>(COMPFS_SCHEME);
+/// Register this service into the given registry.
+pub fn register_compfs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Compfs>(COMPFS_SCHEME);
}
diff --git a/core/services/cos/Cargo.toml b/core/services/cos/Cargo.toml
index 62b5eeb7d..d58d0f71b 100644
--- a/core/services/cos/Cargo.toml
+++ b/core/services/cos/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/cos/src/lib.rs b/core/services/cos/src/lib.rs
index 754899b89..af7712de3 100644
--- a/core/services/cos/src/lib.rs
+++ b/core/services/cos/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for cos service.
pub const COS_SCHEME: &str = "cos";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_cos_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Cos>(COS_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::CosBuilder as Cos;
pub use config::CosConfig;
-
-#[ctor::ctor]
-fn register_cos_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Cos>(COS_SCHEME);
-}
diff --git a/core/services/d1/Cargo.toml b/core/services/d1/Cargo.toml
index 27d80cdac..75157a94c 100644
--- a/core/services/d1/Cargo.toml
+++ b/core/services/d1/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/d1/src/lib.rs b/core/services/d1/src/lib.rs
index 4f76f198c..a9af8f92c 100644
--- a/core/services/d1/src/lib.rs
+++ b/core/services/d1/src/lib.rs
@@ -33,7 +33,7 @@ pub use config::D1Config;
/// Default scheme for d1 service.
pub const D1_SCHEME: &str = "d1";
-#[ctor::ctor]
-fn register_d1_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<D1>(D1_SCHEME);
+/// Register this service into the given registry.
+pub fn register_d1_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<D1>(D1_SCHEME);
}
diff --git a/core/services/dashmap/Cargo.toml b/core/services/dashmap/Cargo.toml
index 750437969..8382650d4 100644
--- a/core/services/dashmap/Cargo.toml
+++ b/core/services/dashmap/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
dashmap = "6"
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/dashmap/src/lib.rs b/core/services/dashmap/src/lib.rs
index c3f609b30..360d409f2 100644
--- a/core/services/dashmap/src/lib.rs
+++ b/core/services/dashmap/src/lib.rs
@@ -33,7 +33,7 @@ pub use config::DashmapConfig;
/// Default scheme for dashmap service.
pub const DASHMAP_SCHEME: &str = "dashmap";
-#[ctor::ctor]
-fn register_dashmap_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Dashmap>(DASHMAP_SCHEME);
+/// Register this service into the given registry.
+pub fn register_dashmap_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Dashmap>(DASHMAP_SCHEME);
}
diff --git a/core/services/dbfs/Cargo.toml b/core/services/dbfs/Cargo.toml
index b56bb2d5e..4d122e5e6 100644
--- a/core/services/dbfs/Cargo.toml
+++ b/core/services/dbfs/Cargo.toml
@@ -33,7 +33,6 @@ all-features = true
[dependencies]
base64 = { workspace = true }
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/dbfs/src/lib.rs b/core/services/dbfs/src/lib.rs
index a0dc4ae99..ab0287de8 100644
--- a/core/services/dbfs/src/lib.rs
+++ b/core/services/dbfs/src/lib.rs
@@ -34,7 +34,7 @@ pub use config::DbfsConfig;
/// Default scheme for dbfs service.
pub const DBFS_SCHEME: &str = "dbfs";
-#[ctor::ctor]
-fn register_dbfs_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Dbfs>(DBFS_SCHEME);
+/// Register this service into the given registry.
+pub fn register_dbfs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Dbfs>(DBFS_SCHEME);
}
diff --git a/core/services/dropbox/Cargo.toml b/core/services/dropbox/Cargo.toml
index 8952013bd..465109f69 100644
--- a/core/services/dropbox/Cargo.toml
+++ b/core/services/dropbox/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
mea = "0.5.1"
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/dropbox/src/lib.rs b/core/services/dropbox/src/lib.rs
index 65d32f249..be8be3188 100644
--- a/core/services/dropbox/src/lib.rs
+++ b/core/services/dropbox/src/lib.rs
@@ -35,7 +35,7 @@ pub use config::DropboxConfig;
/// Default scheme for dropbox service.
pub const DROPBOX_SCHEME: &str = "dropbox";
-#[ctor::ctor]
-fn register_dropbox_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Dropbox>(DROPBOX_SCHEME);
+/// Register this service into the given registry.
+pub fn register_dropbox_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Dropbox>(DROPBOX_SCHEME);
}
diff --git a/core/services/etcd/Cargo.toml b/core/services/etcd/Cargo.toml
index 0893c3080..78686a16b 100644
--- a/core/services/etcd/Cargo.toml
+++ b/core/services/etcd/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
etcd-client = { version = "0.17", features = ["tls"] }
fastpool = "1.0.2"
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/etcd/src/lib.rs b/core/services/etcd/src/lib.rs
index b3dfafbc3..5ce3955ea 100644
--- a/core/services/etcd/src/lib.rs
+++ b/core/services/etcd/src/lib.rs
@@ -34,7 +34,7 @@ pub use config::EtcdConfig;
/// Default scheme for etcd service.
pub const ETCD_SCHEME: &str = "etcd";
-#[ctor::ctor]
-fn register_etcd_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Etcd>(ETCD_SCHEME);
+/// Register this service into the given registry.
+pub fn register_etcd_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Etcd>(ETCD_SCHEME);
}
diff --git a/core/services/foundationdb/Cargo.toml
b/core/services/foundationdb/Cargo.toml
index dd4982506..b8693b390 100644
--- a/core/services/foundationdb/Cargo.toml
+++ b/core/services/foundationdb/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
foundationdb = { version = "0.9.0", features = [
"embedded-fdb-include",
"fdb-7_3",
diff --git a/core/services/foundationdb/src/lib.rs
b/core/services/foundationdb/src/lib.rs
index d544919e9..0bb9b5f52 100644
--- a/core/services/foundationdb/src/lib.rs
+++ b/core/services/foundationdb/src/lib.rs
@@ -32,7 +32,7 @@ pub use config::FoundationdbConfig;
/// Default scheme for foundationdb service.
pub const FOUNDATIONDB_SCHEME: &str = "foundationdb";
-#[ctor::ctor]
-fn register_foundationdb_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Foundationdb>(FOUNDATIONDB_SCHEME);
+/// Register this service into the given registry.
+pub fn register_foundationdb_service(registry:
&opendal_core::OperatorRegistry) {
+ registry.register::<Foundationdb>(FOUNDATIONDB_SCHEME);
}
diff --git a/core/services/fs/Cargo.toml b/core/services/fs/Cargo.toml
index ce886b32d..3aab5a973 100644
--- a/core/services/fs/Cargo.toml
+++ b/core/services/fs/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false, features = [
"internal-tokio-rt",
diff --git a/core/services/fs/src/lib.rs b/core/services/fs/src/lib.rs
index 2867b4923..d5646afa9 100644
--- a/core/services/fs/src/lib.rs
+++ b/core/services/fs/src/lib.rs
@@ -36,9 +36,8 @@ pub const FS_SCHEME: &str = "fs";
/// Alias scheme for fs service that follows the standard URI scheme.
pub const FILE_SCHEME: &str = "file";
-#[ctor::ctor]
-fn register_fs_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Fs>(FS_SCHEME);
- // Register "file" as an alias for "fs" to support standard file:// URIs
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Fs>(FILE_SCHEME);
+/// Register this service into the given registry.
+pub fn register_fs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Fs>(FS_SCHEME);
+ registry.register::<Fs>(FILE_SCHEME);
}
diff --git a/core/services/ftp/Cargo.toml b/core/services/ftp/Cargo.toml
index f7c5ac4ab..50e1f019c 100644
--- a/core/services/ftp/Cargo.toml
+++ b/core/services/ftp/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
fastpool = "1.0.2"
futures = { workspace = true, features = ["std", "async-await"] }
futures-rustls = "0.26.0"
diff --git a/core/services/ftp/src/lib.rs b/core/services/ftp/src/lib.rs
index c812d83dc..376cff5fb 100644
--- a/core/services/ftp/src/lib.rs
+++ b/core/services/ftp/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for ftp service.
pub const FTP_SCHEME: &str = "ftp";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_ftp_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Ftp>(FTP_SCHEME);
+}
mod backend;
mod config;
@@ -31,8 +34,3 @@ mod writer;
pub use backend::FtpBuilder as Ftp;
pub use config::FtpConfig;
-
-#[ctor::ctor]
-fn register_ftp_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Ftp>(FTP_SCHEME);
-}
diff --git a/core/services/gcs/Cargo.toml b/core/services/gcs/Cargo.toml
index 5622ade24..45117664d 100644
--- a/core/services/gcs/Cargo.toml
+++ b/core/services/gcs/Cargo.toml
@@ -33,7 +33,6 @@ all-features = true
[dependencies]
backon = "1.6"
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/gcs/src/lib.rs b/core/services/gcs/src/lib.rs
index 9d9b3e80d..551eceeee 100644
--- a/core/services/gcs/src/lib.rs
+++ b/core/services/gcs/src/lib.rs
@@ -34,7 +34,7 @@ pub use config::GcsConfig;
/// Default scheme for gcs service.
pub const GCS_SCHEME: &str = "gcs";
-#[ctor::ctor]
-fn register_gcs_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Gcs>(GCS_SCHEME);
+/// Register this service into the given registry.
+pub fn register_gcs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Gcs>(GCS_SCHEME);
}
diff --git a/core/services/gdrive/Cargo.toml b/core/services/gdrive/Cargo.toml
index 3cfc6a382..d10b9bcbf 100644
--- a/core/services/gdrive/Cargo.toml
+++ b/core/services/gdrive/Cargo.toml
@@ -36,7 +36,6 @@ opendal-core = { path = "../../core", version = "0.55.0",
default-features = fal
] }
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
mea = "0.5.1"
diff --git a/core/services/gdrive/src/lib.rs b/core/services/gdrive/src/lib.rs
index 051a80020..05baafb78 100644
--- a/core/services/gdrive/src/lib.rs
+++ b/core/services/gdrive/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for gdrive service.
pub const GDRIVE_SCHEME: &str = "gdrive";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_gdrive_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Gdrive>(GDRIVE_SCHEME);
+}
mod backend;
mod builder;
@@ -31,8 +34,3 @@ mod writer;
pub use builder::GdriveBuilder as Gdrive;
pub use config::GdriveConfig;
-
-#[ctor::ctor]
-fn register_gdrive_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Gdrive>(GDRIVE_SCHEME);
-}
diff --git a/core/services/ghac/Cargo.toml b/core/services/ghac/Cargo.toml
index f11196ce3..40a6417ae 100644
--- a/core/services/ghac/Cargo.toml
+++ b/core/services/ghac/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
ghac = { version = "0.2.0", default-features = false }
http = { workspace = true }
log = { workspace = true }
diff --git a/core/services/ghac/src/lib.rs b/core/services/ghac/src/lib.rs
index c1981b075..af93f74f3 100644
--- a/core/services/ghac/src/lib.rs
+++ b/core/services/ghac/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for ghac service.
pub const GHAC_SCHEME: &str = "ghac";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_ghac_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Ghac>(GHAC_SCHEME);
+}
mod backend;
mod config;
@@ -28,8 +31,3 @@ mod writer;
pub use backend::GhacBuilder as Ghac;
pub use config::GhacConfig;
-
-#[ctor::ctor]
-fn register_ghac_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Ghac>(GHAC_SCHEME);
-}
diff --git a/core/services/github/Cargo.toml b/core/services/github/Cargo.toml
index 515bfa4a1..27f45df45 100644
--- a/core/services/github/Cargo.toml
+++ b/core/services/github/Cargo.toml
@@ -33,7 +33,6 @@ all-features = true
[dependencies]
base64 = { workspace = true }
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/github/src/lib.rs b/core/services/github/src/lib.rs
index 7297081cc..2605637d5 100644
--- a/core/services/github/src/lib.rs
+++ b/core/services/github/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for github service.
pub const GITHUB_SCHEME: &str = "github";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_github_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Github>(GITHUB_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::GithubBuilder as Github;
pub use config::GithubConfig;
-
-#[ctor::ctor]
-fn register_github_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Github>(GITHUB_SCHEME);
-}
diff --git a/core/services/github/src/mod.rs b/core/services/github/src/mod.rs
index 9cb8c0abd..bfe899a63 100644
--- a/core/services/github/src/mod.rs
+++ b/core/services/github/src/mod.rs
@@ -18,8 +18,6 @@
/// Default scheme for github service.
pub const GITHUB_SCHEME: &str = "github";
-use crate::types::DEFAULT_OPERATOR_REGISTRY;
-
mod backend;
mod config;
mod core;
@@ -31,7 +29,3 @@ mod writer;
pub use backend::GithubBuilder as Github;
pub use config::GithubConfig;
-#[ctor::ctor]
-fn register_github_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Github>(GITHUB_SCHEME);
-}
diff --git a/core/services/gridfs/Cargo.toml b/core/services/gridfs/Cargo.toml
index 12a704bbe..64a6ae644 100644
--- a/core/services/gridfs/Cargo.toml
+++ b/core/services/gridfs/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
futures = { workspace = true }
mea = "0.5.1"
mongodb = "3.3.0"
diff --git a/core/services/gridfs/src/lib.rs b/core/services/gridfs/src/lib.rs
index fda56982b..7652e8e92 100644
--- a/core/services/gridfs/src/lib.rs
+++ b/core/services/gridfs/src/lib.rs
@@ -32,7 +32,7 @@ pub use config::GridfsConfig;
/// Default scheme for gridfs service.
pub const GRIDFS_SCHEME: &str = "gridfs";
-#[ctor::ctor]
-fn register_gridfs_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Gridfs>(GRIDFS_SCHEME);
+/// Register this service into the given registry.
+pub fn register_gridfs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Gridfs>(GRIDFS_SCHEME);
}
diff --git a/core/services/hdfs-native/Cargo.toml
b/core/services/hdfs-native/Cargo.toml
index 5cab5303d..7997882f6 100644
--- a/core/services/hdfs-native/Cargo.toml
+++ b/core/services/hdfs-native/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
futures = { workspace = true }
hdfs-native = { version = "0.13" }
log = { workspace = true }
diff --git a/core/services/hdfs-native/src/lib.rs
b/core/services/hdfs-native/src/lib.rs
index 1f8b77e36..e8810249e 100644
--- a/core/services/hdfs-native/src/lib.rs
+++ b/core/services/hdfs-native/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for hdfs-native service.
pub const HDFS_NATIVE_SCHEME: &str = "hdfs-native";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_hdfs_native_service(registry: &opendal_core::OperatorRegistry)
{
+ registry.register::<HdfsNative>(HDFS_NATIVE_SCHEME);
+}
mod backend;
mod config;
@@ -31,8 +34,3 @@ mod writer;
pub use backend::HdfsNativeBuilder as HdfsNative;
pub use config::HdfsNativeConfig;
-
-#[ctor::ctor]
-fn register_hdfs_native_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<HdfsNative>(HDFS_NATIVE_SCHEME);
-}
diff --git a/core/services/hdfs/Cargo.toml b/core/services/hdfs/Cargo.toml
index 5e615429f..bdb050304 100644
--- a/core/services/hdfs/Cargo.toml
+++ b/core/services/hdfs/Cargo.toml
@@ -34,7 +34,6 @@ all-features = true
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
bytes = { workspace = true }
-ctor = { workspace = true }
futures = { workspace = true }
hdrs = { version = "0.3.2", features = ["async_file"] }
log = { workspace = true }
diff --git a/core/services/hdfs/src/lib.rs b/core/services/hdfs/src/lib.rs
index 24d852a91..c24c35538 100644
--- a/core/services/hdfs/src/lib.rs
+++ b/core/services/hdfs/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for hdfs service.
pub const HDFS_SCHEME: &str = "hdfs";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_hdfs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Hdfs>(HDFS_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::HdfsBuilder as Hdfs;
pub use config::HdfsConfig;
-
-#[ctor::ctor]
-fn register_hdfs_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Hdfs>(HDFS_SCHEME);
-}
diff --git a/core/services/http/Cargo.toml b/core/services/http/Cargo.toml
index 8365d2b6c..97776bf00 100644
--- a/core/services/http/Cargo.toml
+++ b/core/services/http/Cargo.toml
@@ -27,7 +27,6 @@ version = "0.55.0"
all-features = true
[dependencies]
-ctor = "0.6"
http = "1.1"
log = "0.4"
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/http/src/lib.rs b/core/services/http/src/lib.rs
index f13cc8652..f9a24dcc0 100644
--- a/core/services/http/src/lib.rs
+++ b/core/services/http/src/lib.rs
@@ -30,7 +30,7 @@ pub use config::HttpConfig;
/// Default scheme for http service.
pub const HTTP_SCHEME: &str = "http";
-#[ctor::ctor]
-fn register_http_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Http>(HTTP_SCHEME);
+/// Register this service into the given registry.
+pub fn register_http_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Http>(HTTP_SCHEME);
}
diff --git a/core/services/huggingface/Cargo.toml
b/core/services/huggingface/Cargo.toml
index e6d6c1a84..3bbcf1401 100644
--- a/core/services/huggingface/Cargo.toml
+++ b/core/services/huggingface/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/huggingface/src/lib.rs
b/core/services/huggingface/src/lib.rs
index 31d53239c..227993317 100644
--- a/core/services/huggingface/src/lib.rs
+++ b/core/services/huggingface/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for huggingface service.
pub const HUGGINGFACE_SCHEME: &str = "huggingface";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_huggingface_service(registry: &opendal_core::OperatorRegistry)
{
+ registry.register::<Huggingface>(HUGGINGFACE_SCHEME);
+}
mod backend;
mod config;
@@ -28,8 +31,3 @@ mod lister;
pub use backend::HuggingfaceBuilder as Huggingface;
pub use config::HuggingfaceConfig;
-
-#[ctor::ctor]
-fn register_huggingface_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Huggingface>(HUGGINGFACE_SCHEME);
-}
diff --git a/core/services/ipfs/Cargo.toml b/core/services/ipfs/Cargo.toml
index 9d10c69f4..e82fe862a 100644
--- a/core/services/ipfs/Cargo.toml
+++ b/core/services/ipfs/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/ipfs/src/lib.rs b/core/services/ipfs/src/lib.rs
index 758545ae5..86f0af6db 100644
--- a/core/services/ipfs/src/lib.rs
+++ b/core/services/ipfs/src/lib.rs
@@ -31,7 +31,7 @@ pub use config::IpfsConfig;
/// Default scheme for ipfs service.
pub const IPFS_SCHEME: &str = "ipfs";
-#[ctor::ctor]
-fn register_ipfs_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Ipfs>(IPFS_SCHEME);
+/// Register this service into the given registry.
+pub fn register_ipfs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Ipfs>(IPFS_SCHEME);
}
diff --git a/core/services/ipmfs/Cargo.toml b/core/services/ipmfs/Cargo.toml
index d07c81c8c..6a943d12f 100644
--- a/core/services/ipmfs/Cargo.toml
+++ b/core/services/ipmfs/Cargo.toml
@@ -34,7 +34,6 @@ all-features = true
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/ipmfs/src/lib.rs b/core/services/ipmfs/src/lib.rs
index 62739595c..e71e9f7b4 100644
--- a/core/services/ipmfs/src/lib.rs
+++ b/core/services/ipmfs/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for ipmfs service.
pub const IPMFS_SCHEME: &str = "ipmfs";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_ipmfs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Ipmfs>(IPMFS_SCHEME);
+}
mod backend;
mod builder;
@@ -31,8 +34,3 @@ mod writer;
pub use builder::IpmfsBuilder as Ipmfs;
pub use config::IpmfsConfig;
-
-#[ctor::ctor]
-fn register_ipmfs_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Ipmfs>(IPMFS_SCHEME);
-}
diff --git a/core/services/koofr/Cargo.toml b/core/services/koofr/Cargo.toml
index 12d5119f9..8eb0a6285 100644
--- a/core/services/koofr/Cargo.toml
+++ b/core/services/koofr/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
mea = "0.5.1"
diff --git a/core/services/koofr/src/lib.rs b/core/services/koofr/src/lib.rs
index 163181ac1..1a12d1451 100644
--- a/core/services/koofr/src/lib.rs
+++ b/core/services/koofr/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for koofr service.
pub const KOOFR_SCHEME: &str = "koofr";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_koofr_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Koofr>(KOOFR_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::KoofrBuilder as Koofr;
pub use config::KoofrConfig;
-
-#[ctor::ctor]
-fn register_koofr_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Koofr>(KOOFR_SCHEME);
-}
diff --git a/core/services/lakefs/Cargo.toml b/core/services/lakefs/Cargo.toml
index ce63dce93..a8bc15478 100644
--- a/core/services/lakefs/Cargo.toml
+++ b/core/services/lakefs/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/lakefs/src/lib.rs b/core/services/lakefs/src/lib.rs
index b9e0076f8..c9c53afc4 100644
--- a/core/services/lakefs/src/lib.rs
+++ b/core/services/lakefs/src/lib.rs
@@ -34,7 +34,7 @@ pub use config::LakefsConfig;
/// Default scheme for lakefs service.
pub const LAKEFS_SCHEME: &str = "lakefs";
-#[ctor::ctor]
-fn register_lakefs_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Lakefs>(LAKEFS_SCHEME);
+/// Register this service into the given registry.
+pub fn register_lakefs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Lakefs>(LAKEFS_SCHEME);
}
diff --git a/core/services/memcached/Cargo.toml
b/core/services/memcached/Cargo.toml
index a9ddf394d..fa8ea87aa 100644
--- a/core/services/memcached/Cargo.toml
+++ b/core/services/memcached/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
fastpool = "1.0.2"
http = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/memcached/src/lib.rs
b/core/services/memcached/src/lib.rs
index 6555ef270..04acee458 100644
--- a/core/services/memcached/src/lib.rs
+++ b/core/services/memcached/src/lib.rs
@@ -33,7 +33,7 @@ pub use config::MemcachedConfig;
/// Default scheme for memcached service.
pub const MEMCACHED_SCHEME: &str = "memcached";
-#[ctor::ctor]
-fn register_memcached_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Memcached>(MEMCACHED_SCHEME);
+/// Register this service into the given registry.
+pub fn register_memcached_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Memcached>(MEMCACHED_SCHEME);
}
diff --git a/core/services/mini_moka/Cargo.toml
b/core/services/mini_moka/Cargo.toml
index 24483bdb4..b7fab46f7 100644
--- a/core/services/mini_moka/Cargo.toml
+++ b/core/services/mini_moka/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
log = { workspace = true }
mini-moka = "0.10"
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/mini_moka/src/lib.rs
b/core/services/mini_moka/src/lib.rs
index 322009c2f..200d474a9 100644
--- a/core/services/mini_moka/src/lib.rs
+++ b/core/services/mini_moka/src/lib.rs
@@ -33,7 +33,7 @@ pub use config::MiniMokaConfig;
/// Default scheme for mini-moka service.
pub const MINI_MOKA_SCHEME: &str = "mini-moka";
-#[ctor::ctor]
-fn register_minimoka_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<MiniMoka>(MINI_MOKA_SCHEME);
+/// Register this service into the given registry.
+pub fn register_mini_moka_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<MiniMoka>(MINI_MOKA_SCHEME);
}
diff --git a/core/services/moka/Cargo.toml b/core/services/moka/Cargo.toml
index 6b9aaa1ed..9b00374f6 100644
--- a/core/services/moka/Cargo.toml
+++ b/core/services/moka/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
log = { workspace = true }
moka = { version = "0.12", features = ["future", "sync"] }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/moka/src/lib.rs b/core/services/moka/src/lib.rs
index 9b9e70215..842eac364 100644
--- a/core/services/moka/src/lib.rs
+++ b/core/services/moka/src/lib.rs
@@ -34,7 +34,7 @@ pub use core::MokaValue;
/// Default scheme for moka service.
pub const MOKA_SCHEME: &str = "moka";
-#[ctor::ctor]
-fn register_moka_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Moka>(MOKA_SCHEME);
+/// Register this service into the given registry.
+pub fn register_moka_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Moka>(MOKA_SCHEME);
}
diff --git a/core/services/mongodb/Cargo.toml b/core/services/mongodb/Cargo.toml
index 5c114c83b..d8fd6794e 100644
--- a/core/services/mongodb/Cargo.toml
+++ b/core/services/mongodb/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
mea = "0.5.1"
mongodb = { version = "3.3.0" }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/mongodb/src/lib.rs b/core/services/mongodb/src/lib.rs
index c9611b1df..6ea1cde8e 100644
--- a/core/services/mongodb/src/lib.rs
+++ b/core/services/mongodb/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for mongodb service.
pub const MONGODB_SCHEME: &str = "mongodb";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_mongodb_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Mongodb>(MONGODB_SCHEME);
+}
mod backend;
mod config;
@@ -28,8 +31,3 @@ mod writer;
pub use backend::MongodbBuilder as Mongodb;
pub use config::MongodbConfig;
-
-#[ctor::ctor]
-fn register_mongodb_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Mongodb>(MONGODB_SCHEME);
-}
diff --git a/core/services/monoiofs/Cargo.toml
b/core/services/monoiofs/Cargo.toml
index 846c647c6..676fb4466 100644
--- a/core/services/monoiofs/Cargo.toml
+++ b/core/services/monoiofs/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
flume = "0.11"
futures = { workspace = true, features = ["std", "async-await"] }
monoio = { version = "0.2.4", features = [
diff --git a/core/services/monoiofs/src/lib.rs
b/core/services/monoiofs/src/lib.rs
index 773ce1f88..b21ddf58b 100644
--- a/core/services/monoiofs/src/lib.rs
+++ b/core/services/monoiofs/src/lib.rs
@@ -33,7 +33,7 @@ pub use config::MonoiofsConfig;
/// Default scheme for monoiofs service.
pub const MONOIOFS_SCHEME: &str = "monoiofs";
-#[ctor::ctor]
-fn register_monoiofs_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Monoiofs>(MONOIOFS_SCHEME);
+/// Register this service into the given registry.
+pub fn register_monoiofs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Monoiofs>(MONOIOFS_SCHEME);
}
diff --git a/core/services/mysql/Cargo.toml b/core/services/mysql/Cargo.toml
index d5a249a3e..01d616ba3 100644
--- a/core/services/mysql/Cargo.toml
+++ b/core/services/mysql/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
mea = "0.5.1"
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/mysql/src/lib.rs b/core/services/mysql/src/lib.rs
index c16bcdc06..7370e3315 100644
--- a/core/services/mysql/src/lib.rs
+++ b/core/services/mysql/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for mysql service.
pub const MYSQL_SCHEME: &str = "mysql";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_mysql_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Mysql>(MYSQL_SCHEME);
+}
mod backend;
mod config;
@@ -28,8 +31,3 @@ mod writer;
pub use backend::MysqlBuilder as Mysql;
pub use config::MysqlConfig;
-
-#[ctor::ctor]
-fn register_mysql_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Mysql>(MYSQL_SCHEME);
-}
diff --git a/core/services/obs/Cargo.toml b/core/services/obs/Cargo.toml
index b6f805738..3bd2582c0 100644
--- a/core/services/obs/Cargo.toml
+++ b/core/services/obs/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/obs/src/lib.rs b/core/services/obs/src/lib.rs
index aa60f8e09..93cce0c0b 100644
--- a/core/services/obs/src/lib.rs
+++ b/core/services/obs/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for obs service.
pub const OBS_SCHEME: &str = "obs";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_obs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Obs>(OBS_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::ObsBuilder as Obs;
pub use config::ObsConfig;
-
-#[ctor::ctor]
-fn register_obs_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Obs>(OBS_SCHEME);
-}
diff --git a/core/services/onedrive/Cargo.toml
b/core/services/onedrive/Cargo.toml
index d0396921a..69a92d203 100644
--- a/core/services/onedrive/Cargo.toml
+++ b/core/services/onedrive/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
mea = { version = "0.5.1" }
diff --git a/core/services/onedrive/src/lib.rs
b/core/services/onedrive/src/lib.rs
index 3493d2478..d4c82cb14 100644
--- a/core/services/onedrive/src/lib.rs
+++ b/core/services/onedrive/src/lib.rs
@@ -35,7 +35,7 @@ pub use config::OnedriveConfig;
/// Default scheme for onedrive service.
pub const ONEDRIVE_SCHEME: &str = "onedrive";
-#[ctor::ctor]
-fn register_onedrive_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Onedrive>(ONEDRIVE_SCHEME);
+/// Register this service into the given registry.
+pub fn register_onedrive_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Onedrive>(ONEDRIVE_SCHEME);
}
diff --git a/core/services/opfs/Cargo.toml b/core/services/opfs/Cargo.toml
index fc9107ced..b82b11271 100644
--- a/core/services/opfs/Cargo.toml
+++ b/core/services/opfs/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[target.'cfg(target_arch = "wasm32")'.dependencies]
-ctor = { workspace = true }
js-sys = "0.3.77"
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/opfs/src/lib.rs b/core/services/opfs/src/lib.rs
index 98fb8bcba..06887f57f 100644
--- a/core/services/opfs/src/lib.rs
+++ b/core/services/opfs/src/lib.rs
@@ -20,7 +20,10 @@
/// Default scheme for opfs service.
pub const OPFS_SCHEME: &str = "opfs";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_opfs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Opfs>(OPFS_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod utils;
pub use backend::OpfsBuilder as Opfs;
pub use config::OpfsConfig;
-
-#[ctor::ctor]
-fn register_opfs_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Opfs>(OPFS_SCHEME);
-}
diff --git a/core/services/oss/Cargo.toml b/core/services/oss/Cargo.toml
index 6d392824b..47eff2941 100644
--- a/core/services/oss/Cargo.toml
+++ b/core/services/oss/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/oss/src/lib.rs b/core/services/oss/src/lib.rs
index a995973d2..6b8a330a7 100644
--- a/core/services/oss/src/lib.rs
+++ b/core/services/oss/src/lib.rs
@@ -33,7 +33,7 @@ pub use config::OssConfig;
/// Default scheme for oss service.
pub const OSS_SCHEME: &str = "oss";
-#[ctor::ctor]
-fn register_oss_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Oss>(OSS_SCHEME);
+/// Register this service into the given registry.
+pub fn register_oss_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Oss>(OSS_SCHEME);
}
diff --git a/core/services/pcloud/Cargo.toml b/core/services/pcloud/Cargo.toml
index e45576add..874317e53 100644
--- a/core/services/pcloud/Cargo.toml
+++ b/core/services/pcloud/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/pcloud/src/lib.rs b/core/services/pcloud/src/lib.rs
index d8ce9e499..769f9f100 100644
--- a/core/services/pcloud/src/lib.rs
+++ b/core/services/pcloud/src/lib.rs
@@ -33,7 +33,7 @@ pub use config::PcloudConfig;
/// Default scheme for pcloud service.
pub const PCLOUD_SCHEME: &str = "pcloud";
-#[ctor::ctor]
-fn register_pcloud_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Pcloud>(PCLOUD_SCHEME);
+/// Register this service into the given registry.
+pub fn register_pcloud_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Pcloud>(PCLOUD_SCHEME);
}
diff --git a/core/services/persy/Cargo.toml b/core/services/persy/Cargo.toml
index c87806d3e..2f592c80a 100644
--- a/core/services/persy/Cargo.toml
+++ b/core/services/persy/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
persy = "1.7.1"
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/persy/src/lib.rs b/core/services/persy/src/lib.rs
index 2c3993f84..15c34ea1e 100644
--- a/core/services/persy/src/lib.rs
+++ b/core/services/persy/src/lib.rs
@@ -31,7 +31,7 @@ pub use config::PersyConfig;
/// Default scheme for persy service.
pub const PERSY_SCHEME: &str = "persy";
-#[ctor::ctor]
-fn register_persy_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Persy>(PERSY_SCHEME);
+/// Register this service into the given registry.
+pub fn register_persy_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Persy>(PERSY_SCHEME);
}
diff --git a/core/services/postgresql/Cargo.toml
b/core/services/postgresql/Cargo.toml
index 5c26a8af3..acbec9c95 100644
--- a/core/services/postgresql/Cargo.toml
+++ b/core/services/postgresql/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
mea = "0.5.1"
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/postgresql/src/lib.rs
b/core/services/postgresql/src/lib.rs
index 0d2d27635..9842ae0a5 100644
--- a/core/services/postgresql/src/lib.rs
+++ b/core/services/postgresql/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for postgresql service.
pub const POSTGRESQL_SCHEME: &str = "postgresql";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_postgresql_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Postgresql>(POSTGRESQL_SCHEME);
+}
mod backend;
mod config;
@@ -28,8 +31,3 @@ mod writer;
pub use backend::PostgresqlBuilder as Postgresql;
pub use config::PostgresqlConfig;
-
-#[ctor::ctor]
-fn register_postgresql_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Postgresql>(POSTGRESQL_SCHEME);
-}
diff --git a/core/services/redb/Cargo.toml b/core/services/redb/Cargo.toml
index c4a2d4fc2..67218c17b 100644
--- a/core/services/redb/Cargo.toml
+++ b/core/services/redb/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
redb = { version = "2" }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/redb/src/lib.rs b/core/services/redb/src/lib.rs
index 2b7ffb075..795d7ddf1 100644
--- a/core/services/redb/src/lib.rs
+++ b/core/services/redb/src/lib.rs
@@ -31,7 +31,7 @@ pub use config::RedbConfig;
/// Default scheme for redb service.
pub const REDB_SCHEME: &str = "redb";
-#[ctor::ctor]
-fn register_redb_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Redb>(REDB_SCHEME);
+/// Register this service into the given registry.
+pub fn register_redb_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Redb>(REDB_SCHEME);
}
diff --git a/core/services/redis/Cargo.toml b/core/services/redis/Cargo.toml
index e28c9ba67..5f3e43a06 100644
--- a/core/services/redis/Cargo.toml
+++ b/core/services/redis/Cargo.toml
@@ -37,7 +37,6 @@ rustls = ["redis/tokio-rustls-comp"]
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
fastpool = "1.0.2"
http = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/redis/src/lib.rs b/core/services/redis/src/lib.rs
index a2f99e58b..f0d210ac8 100644
--- a/core/services/redis/src/lib.rs
+++ b/core/services/redis/src/lib.rs
@@ -32,7 +32,7 @@ pub use config::RedisConfig;
/// Default scheme for redis service.
pub const REDIS_SCHEME: &str = "redis";
-#[ctor::ctor]
-fn register_redis_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Redis>(REDIS_SCHEME);
+/// Register this service into the given registry.
+pub fn register_redis_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Redis>(REDIS_SCHEME);
}
diff --git a/core/services/rocksdb/Cargo.toml b/core/services/rocksdb/Cargo.toml
index 55433205a..3041ec509 100644
--- a/core/services/rocksdb/Cargo.toml
+++ b/core/services/rocksdb/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
rocksdb = { version = "0.21.0", default-features = false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/rocksdb/src/lib.rs b/core/services/rocksdb/src/lib.rs
index 344a5f310..5bbc4302c 100644
--- a/core/services/rocksdb/src/lib.rs
+++ b/core/services/rocksdb/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for rocksdb service.
pub const ROCKSDB_SCHEME: &str = "rocksdb";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_rocksdb_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Rocksdb>(ROCKSDB_SCHEME);
+}
mod backend;
mod config;
@@ -29,8 +32,3 @@ mod writer;
pub use crate::backend::RocksdbBuilder as Rocksdb;
pub use crate::config::RocksdbConfig;
-
-#[ctor::ctor]
-fn register_rocksdb_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Rocksdb>(ROCKSDB_SCHEME);
-}
diff --git a/core/services/s3/Cargo.toml b/core/services/s3/Cargo.toml
index 55af551c9..f13928ab1 100644
--- a/core/services/s3/Cargo.toml
+++ b/core/services/s3/Cargo.toml
@@ -34,7 +34,6 @@ all-features = true
base64 = { workspace = true }
bytes = { workspace = true }
crc32c = "0.6.6"
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
md-5 = "0.10"
diff --git a/core/services/s3/src/lib.rs b/core/services/s3/src/lib.rs
index 57b39c419..de67ed161 100644
--- a/core/services/s3/src/lib.rs
+++ b/core/services/s3/src/lib.rs
@@ -33,7 +33,7 @@ pub use config::S3Config;
/// Default scheme for s3 service.
pub const S3_SCHEME: &str = "s3";
-#[ctor::ctor]
-fn register_s3_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<S3>(S3_SCHEME);
+/// Register this service into the given registry.
+pub fn register_s3_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<S3>(S3_SCHEME);
}
diff --git a/core/services/s3/src/mod.rs b/core/services/s3/src/mod.rs
index 5407b1653..69d3819b3 100644
--- a/core/services/s3/src/mod.rs
+++ b/core/services/s3/src/mod.rs
@@ -18,8 +18,6 @@
/// Default scheme for s3 service.
pub const S3_SCHEME: &str = "s3";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
-
mod backend;
mod config;
mod core;
@@ -31,7 +29,3 @@ mod writer;
pub use backend::S3Builder as S3;
pub use config::S3Config;
-#[ctor::ctor]
-fn register_s3_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<S3>(S3_SCHEME);
-}
diff --git a/core/services/seafile/Cargo.toml b/core/services/seafile/Cargo.toml
index 834cca095..72309b55f 100644
--- a/core/services/seafile/Cargo.toml
+++ b/core/services/seafile/Cargo.toml
@@ -34,7 +34,6 @@ all-features = true
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
mea = "0.5.1"
diff --git a/core/services/seafile/src/lib.rs b/core/services/seafile/src/lib.rs
index 2efc50089..3c6f843e0 100644
--- a/core/services/seafile/src/lib.rs
+++ b/core/services/seafile/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for seafile service.
pub const SEAFILE_SCHEME: &str = "seafile";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_seafile_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Seafile>(SEAFILE_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::SeafileBuilder as Seafile;
pub use config::SeafileConfig;
-
-#[ctor::ctor]
-fn register_seafile_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Seafile>(SEAFILE_SCHEME);
-}
diff --git a/core/services/sftp/Cargo.toml b/core/services/sftp/Cargo.toml
index 5186394ef..98e3967eb 100644
--- a/core/services/sftp/Cargo.toml
+++ b/core/services/sftp/Cargo.toml
@@ -34,7 +34,6 @@ all-features = true
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
bytes = { workspace = true }
-ctor = { workspace = true }
fastpool = "1.0.2"
futures = { workspace = true }
log = { workspace = true }
diff --git a/core/services/sftp/src/lib.rs b/core/services/sftp/src/lib.rs
index 878be1956..18cd262ac 100644
--- a/core/services/sftp/src/lib.rs
+++ b/core/services/sftp/src/lib.rs
@@ -36,7 +36,7 @@ pub use config::SftpConfig;
/// Default scheme for sftp service.
pub const SFTP_SCHEME: &str = "sftp";
-#[ctor::ctor]
-fn register_sftp_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Sftp>(SFTP_SCHEME);
+/// Register this service into the given registry.
+pub fn register_sftp_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Sftp>(SFTP_SCHEME);
}
diff --git a/core/services/sled/Cargo.toml b/core/services/sled/Cargo.toml
index 12b3289e4..0b7e8e91b 100644
--- a/core/services/sled/Cargo.toml
+++ b/core/services/sled/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
sled = "0.34.7"
diff --git a/core/services/sled/src/lib.rs b/core/services/sled/src/lib.rs
index 91196be64..3977d1fe2 100644
--- a/core/services/sled/src/lib.rs
+++ b/core/services/sled/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for sled service.
pub const SLED_SCHEME: &str = "sled";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_sled_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Sled>(SLED_SCHEME);
+}
mod backend;
mod config;
@@ -29,8 +32,3 @@ mod writer;
pub use backend::SledBuilder as Sled;
pub use config::SledConfig;
-
-#[ctor::ctor]
-fn register_sled_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Sled>(SLED_SCHEME);
-}
diff --git a/core/services/sqlite/Cargo.toml b/core/services/sqlite/Cargo.toml
index 3a7839080..9973ebd09 100644
--- a/core/services/sqlite/Cargo.toml
+++ b/core/services/sqlite/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
mea = "0.5.1"
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/sqlite/src/lib.rs b/core/services/sqlite/src/lib.rs
index 4178520d3..b950c6f4a 100644
--- a/core/services/sqlite/src/lib.rs
+++ b/core/services/sqlite/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for sqlite service.
pub const SQLITE_SCHEME: &str = "sqlite";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_sqlite_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Sqlite>(SQLITE_SCHEME);
+}
mod backend;
mod config;
@@ -28,8 +31,3 @@ mod writer;
pub use backend::SqliteBuilder as Sqlite;
pub use config::SqliteConfig;
-
-#[ctor::ctor]
-fn register_sqlite_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Sqlite>(SQLITE_SCHEME);
-}
diff --git a/core/services/surrealdb/Cargo.toml
b/core/services/surrealdb/Cargo.toml
index 64b46e856..54a8d7980 100644
--- a/core/services/surrealdb/Cargo.toml
+++ b/core/services/surrealdb/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
mea = "0.5.1"
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/surrealdb/src/lib.rs
b/core/services/surrealdb/src/lib.rs
index 0ea8ba131..2d88c35c9 100644
--- a/core/services/surrealdb/src/lib.rs
+++ b/core/services/surrealdb/src/lib.rs
@@ -31,7 +31,7 @@ pub use config::SurrealdbConfig;
/// Default scheme for surrealdb service.
pub const SURREALDB_SCHEME: &str = "surrealdb";
-#[ctor::ctor]
-fn register_surrealdb_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Surrealdb>(SURREALDB_SCHEME);
+/// Register this service into the given registry.
+pub fn register_surrealdb_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Surrealdb>(SURREALDB_SCHEME);
}
diff --git a/core/services/swift/Cargo.toml b/core/services/swift/Cargo.toml
index 508aaf4fd..eb2914e0b 100644
--- a/core/services/swift/Cargo.toml
+++ b/core/services/swift/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/swift/src/lib.rs b/core/services/swift/src/lib.rs
index 1d6d04025..5616b3d9a 100644
--- a/core/services/swift/src/lib.rs
+++ b/core/services/swift/src/lib.rs
@@ -20,8 +20,6 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(missing_docs)]
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
-
mod backend;
mod config;
mod core;
@@ -36,7 +34,7 @@ pub use config::SwiftConfig;
/// Default scheme for swift service.
pub const SWIFT_SCHEME: &str = "swift";
-#[ctor::ctor]
-fn register_swift_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Swift>(SWIFT_SCHEME);
+/// Register this service into the given registry.
+pub fn register_swift_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Swift>(SWIFT_SCHEME);
}
diff --git a/core/services/tikv/Cargo.toml b/core/services/tikv/Cargo.toml
index ca9dc6e64..a7f2dba4c 100644
--- a/core/services/tikv/Cargo.toml
+++ b/core/services/tikv/Cargo.toml
@@ -31,7 +31,6 @@ version = { workspace = true }
all-features = true
[dependencies]
-ctor = { workspace = true }
mea = "0.5.1"
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/tikv/src/lib.rs b/core/services/tikv/src/lib.rs
index 4eeb536ef..b9f22016d 100644
--- a/core/services/tikv/src/lib.rs
+++ b/core/services/tikv/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for tikv service.
pub const TIKV_SCHEME: &str = "tikv";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_tikv_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Tikv>(TIKV_SCHEME);
+}
mod backend;
mod config;
@@ -28,8 +31,3 @@ mod writer;
pub use backend::TikvBuilder as Tikv;
pub use config::TikvConfig;
-
-#[ctor::ctor]
-fn register_tikv_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Tikv>(TIKV_SCHEME);
-}
diff --git a/core/services/upyun/Cargo.toml b/core/services/upyun/Cargo.toml
index 1f64da4df..a9b97cc49 100644
--- a/core/services/upyun/Cargo.toml
+++ b/core/services/upyun/Cargo.toml
@@ -33,7 +33,6 @@ all-features = true
[dependencies]
base64 = { workspace = true }
bytes = { workspace = true }
-ctor = { workspace = true }
hmac = "0.12.1"
http = { workspace = true }
log = { workspace = true }
diff --git a/core/services/upyun/src/lib.rs b/core/services/upyun/src/lib.rs
index 10359b9fd..af3b5c428 100644
--- a/core/services/upyun/src/lib.rs
+++ b/core/services/upyun/src/lib.rs
@@ -34,7 +34,7 @@ pub use config::UpyunConfig;
/// Default scheme for upyun service.
pub const UPYUN_SCHEME: &str = "upyun";
-#[ctor::ctor]
-fn register_upyun_service() {
- opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Upyun>(UPYUN_SCHEME);
+/// Register this service into the given registry.
+pub fn register_upyun_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Upyun>(UPYUN_SCHEME);
}
diff --git a/core/services/vercel-artifacts/Cargo.toml
b/core/services/vercel-artifacts/Cargo.toml
index ac1c4f711..5098d1467 100644
--- a/core/services/vercel-artifacts/Cargo.toml
+++ b/core/services/vercel-artifacts/Cargo.toml
@@ -34,7 +34,6 @@ all-features = true
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
serde = { workspace = true, features = ["derive"] }
diff --git a/core/services/vercel-artifacts/src/lib.rs
b/core/services/vercel-artifacts/src/lib.rs
index ab15d005f..ed509ec41 100644
--- a/core/services/vercel-artifacts/src/lib.rs
+++ b/core/services/vercel-artifacts/src/lib.rs
@@ -20,7 +20,10 @@
/// Default scheme for vercel-artifacts service.
pub const VERCEL_ARTIFACTS_SCHEME: &str = "vercel-artifacts";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_vercel_artifacts_service(registry:
&opendal_core::OperatorRegistry) {
+ registry.register::<VercelArtifacts>(VERCEL_ARTIFACTS_SCHEME);
+}
mod backend;
mod builder;
@@ -31,8 +34,3 @@ mod writer;
pub use builder::VercelArtifactsBuilder as VercelArtifacts;
pub use config::VercelArtifactsConfig;
-
-#[ctor::ctor]
-fn register_vercelartifacts_service() {
-
DEFAULT_OPERATOR_REGISTRY.register::<VercelArtifacts>(VERCEL_ARTIFACTS_SCHEME);
-}
diff --git a/core/services/vercel-blob/Cargo.toml
b/core/services/vercel-blob/Cargo.toml
index 375ee7e30..764e06073 100644
--- a/core/services/vercel-blob/Cargo.toml
+++ b/core/services/vercel-blob/Cargo.toml
@@ -32,7 +32,6 @@ all-features = true
[dependencies]
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
diff --git a/core/services/vercel-blob/src/lib.rs
b/core/services/vercel-blob/src/lib.rs
index 495297e0b..0352a125d 100644
--- a/core/services/vercel-blob/src/lib.rs
+++ b/core/services/vercel-blob/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for vercel-blob service.
pub const VERCEL_BLOB_SCHEME: &str = "vercel-blob";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_vercel_blob_service(registry: &opendal_core::OperatorRegistry)
{
+ registry.register::<VercelBlob>(VERCEL_BLOB_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::VercelBlobBuilder as VercelBlob;
pub use config::VercelBlobConfig;
-
-#[ctor::ctor]
-fn register_vercelblob_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<VercelBlob>(VERCEL_BLOB_SCHEME);
-}
diff --git a/core/services/webdav/Cargo.toml b/core/services/webdav/Cargo.toml
index f65588fcb..1cbcec067 100644
--- a/core/services/webdav/Cargo.toml
+++ b/core/services/webdav/Cargo.toml
@@ -33,7 +33,6 @@ all-features = true
[dependencies]
anyhow = { version = "1.0.100", features = ["std"] }
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
mea = "0.5.1"
diff --git a/core/services/webdav/src/lib.rs b/core/services/webdav/src/lib.rs
index 3949894c3..3331155f9 100644
--- a/core/services/webdav/src/lib.rs
+++ b/core/services/webdav/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for webdav service.
pub const WEBDAV_SCHEME: &str = "webdav";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_webdav_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Webdav>(WEBDAV_SCHEME);
+}
mod backend;
mod config;
@@ -30,8 +33,3 @@ mod writer;
pub use backend::WebdavBuilder as Webdav;
pub use config::WebdavConfig;
-
-#[ctor::ctor]
-fn register_webdav_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Webdav>(WEBDAV_SCHEME);
-}
diff --git a/core/services/webhdfs/Cargo.toml b/core/services/webhdfs/Cargo.toml
index 157d692d4..89c8a233a 100644
--- a/core/services/webhdfs/Cargo.toml
+++ b/core/services/webhdfs/Cargo.toml
@@ -33,7 +33,6 @@ all-features = true
[dependencies]
anyhow = { version = "1.0.100", features = ["std"] }
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
mea = "0.5.1"
diff --git a/core/services/webhdfs/src/lib.rs b/core/services/webhdfs/src/lib.rs
index 90fe4ba69..cc19429e7 100644
--- a/core/services/webhdfs/src/lib.rs
+++ b/core/services/webhdfs/src/lib.rs
@@ -18,7 +18,10 @@
/// Default scheme for webhdfs service.
pub const WEBHDFS_SCHEME: &str = "webhdfs";
-use opendal_core::DEFAULT_OPERATOR_REGISTRY;
+/// Register this service into the given registry.
+pub fn register_webhdfs_service(registry: &opendal_core::OperatorRegistry) {
+ registry.register::<Webhdfs>(WEBHDFS_SCHEME);
+}
mod backend;
mod config;
@@ -31,8 +34,3 @@ mod writer;
pub use backend::WebhdfsBuilder as Webhdfs;
pub use config::WebhdfsConfig;
-
-#[ctor::ctor]
-fn register_webhdfs_service() {
- DEFAULT_OPERATOR_REGISTRY.register::<Webhdfs>(WEBHDFS_SCHEME);
-}
diff --git a/core/services/yandex-disk/Cargo.toml
b/core/services/yandex-disk/Cargo.toml
index 272e4758a..27f6c6b9e 100644
--- a/core/services/yandex-disk/Cargo.toml
+++ b/core/services/yandex-disk/Cargo.toml
@@ -34,7 +34,6 @@ all-features = true
opendal-core = { path = "../../core", version = "0.55.0", default-features =
false }
bytes = { workspace = true }
-ctor = { workspace = true }
http = { workspace = true }
log = { workspace = true }
quick-xml = { workspace = true }
diff --git a/core/services/yandex-disk/src/lib.rs
b/core/services/yandex-disk/src/lib.rs
index b79d4e885..232341dae 100644
--- a/core/services/yandex-disk/src/lib.rs
+++ b/core/services/yandex-disk/src/lib.rs
@@ -33,7 +33,7 @@ pub use config::YandexDiskConfig;
/// Default scheme for yandex-disk service.
pub const YANDEX_DISK_SCHEME: &str = "yandex-disk";
-#[ctor::ctor]
-fn register_yandexdisk_service() {
-
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<YandexDisk>(YANDEX_DISK_SCHEME);
+/// Register this service into the given registry.
+pub fn register_yandex_disk_service(registry: &opendal_core::OperatorRegistry)
{
+ registry.register::<YandexDisk>(YANDEX_DISK_SCHEME);
}
diff --git a/core/src/lib.rs b/core/src/lib.rs
index f45746d41..da5589d77 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -25,7 +25,219 @@
pub use opendal_core::*;
#[cfg(feature = "tests")]
-pub use opendal_testkit as tests;
+pub extern crate opendal_testkit as tests;
+
+static DEFAULT_REGISTRY_INIT: std::sync::Once = std::sync::Once::new();
+
+/// Initialize [`DEFAULT_OPERATOR_REGISTRY`] with enabled services.
+///
+/// This function is safe to call multiple times and will only perform
+/// initialization once.
+///
+/// # Notes
+///
+/// Some bindings link `opendal` as a `staticlib`, where `#[ctor::ctor]`
+/// initializers may not be executed due to linker behavior. Those bindings
+/// should call this function explicitly before using `Operator::from_uri` or
+/// `Operator::via_iter`.
+pub fn init_default_registry() {
+ DEFAULT_REGISTRY_INIT.call_once(|| {
+ let registry = &opendal_core::DEFAULT_OPERATOR_REGISTRY;
+ init_default_registry_inner(registry);
+ });
+}
+
+fn init_default_registry_inner(registry: &opendal_core::OperatorRegistry) {
+ opendal_core::services::register_memory_service(registry);
+
+ #[cfg(feature = "services-aliyun-drive")]
+ opendal_service_aliyun_drive::register_aliyun_drive_service(registry);
+
+ #[cfg(feature = "services-alluxio")]
+ opendal_service_alluxio::register_alluxio_service(registry);
+
+ #[cfg(feature = "services-azblob")]
+ opendal_service_azblob::register_azblob_service(registry);
+
+ #[cfg(feature = "services-azdls")]
+ opendal_service_azdls::register_azdls_service(registry);
+
+ #[cfg(feature = "services-azfile")]
+ opendal_service_azfile::register_azfile_service(registry);
+
+ #[cfg(feature = "services-b2")]
+ opendal_service_b2::register_b2_service(registry);
+
+ #[cfg(feature = "services-cacache")]
+ opendal_service_cacache::register_cacache_service(registry);
+
+ #[cfg(feature = "services-cloudflare-kv")]
+ opendal_service_cloudflare_kv::register_cloudflare_kv_service(registry);
+
+ #[cfg(feature = "services-compfs")]
+ opendal_service_compfs::register_compfs_service(registry);
+
+ #[cfg(feature = "services-cos")]
+ opendal_service_cos::register_cos_service(registry);
+
+ #[cfg(feature = "services-d1")]
+ opendal_service_d1::register_d1_service(registry);
+
+ #[cfg(feature = "services-dashmap")]
+ opendal_service_dashmap::register_dashmap_service(registry);
+
+ #[cfg(feature = "services-dbfs")]
+ opendal_service_dbfs::register_dbfs_service(registry);
+
+ #[cfg(feature = "services-dropbox")]
+ opendal_service_dropbox::register_dropbox_service(registry);
+
+ #[cfg(feature = "services-etcd")]
+ opendal_service_etcd::register_etcd_service(registry);
+
+ #[cfg(feature = "services-foundationdb")]
+ opendal_service_foundationdb::register_foundationdb_service(registry);
+
+ #[cfg(feature = "services-fs")]
+ opendal_service_fs::register_fs_service(registry);
+
+ #[cfg(feature = "services-ftp")]
+ opendal_service_ftp::register_ftp_service(registry);
+
+ #[cfg(feature = "services-gcs")]
+ opendal_service_gcs::register_gcs_service(registry);
+
+ #[cfg(feature = "services-gdrive")]
+ opendal_service_gdrive::register_gdrive_service(registry);
+
+ #[cfg(feature = "services-ghac")]
+ opendal_service_ghac::register_ghac_service(registry);
+
+ #[cfg(feature = "services-github")]
+ opendal_service_github::register_github_service(registry);
+
+ #[cfg(feature = "services-gridfs")]
+ opendal_service_gridfs::register_gridfs_service(registry);
+
+ #[cfg(feature = "services-hdfs")]
+ opendal_service_hdfs::register_hdfs_service(registry);
+
+ #[cfg(feature = "services-hdfs-native")]
+ opendal_service_hdfs_native::register_hdfs_native_service(registry);
+
+ #[cfg(feature = "services-http")]
+ opendal_service_http::register_http_service(registry);
+
+ #[cfg(feature = "services-huggingface")]
+ opendal_service_huggingface::register_huggingface_service(registry);
+
+ #[cfg(feature = "services-ipfs")]
+ opendal_service_ipfs::register_ipfs_service(registry);
+
+ #[cfg(feature = "services-ipmfs")]
+ opendal_service_ipmfs::register_ipmfs_service(registry);
+
+ #[cfg(feature = "services-koofr")]
+ opendal_service_koofr::register_koofr_service(registry);
+
+ #[cfg(feature = "services-lakefs")]
+ opendal_service_lakefs::register_lakefs_service(registry);
+
+ #[cfg(feature = "services-memcached")]
+ opendal_service_memcached::register_memcached_service(registry);
+
+ #[cfg(feature = "services-mini-moka")]
+ opendal_service_mini_moka::register_mini_moka_service(registry);
+
+ #[cfg(feature = "services-moka")]
+ opendal_service_moka::register_moka_service(registry);
+
+ #[cfg(feature = "services-mongodb")]
+ opendal_service_mongodb::register_mongodb_service(registry);
+
+ #[cfg(feature = "services-monoiofs")]
+ opendal_service_monoiofs::register_monoiofs_service(registry);
+
+ #[cfg(feature = "services-mysql")]
+ opendal_service_mysql::register_mysql_service(registry);
+
+ #[cfg(feature = "services-obs")]
+ opendal_service_obs::register_obs_service(registry);
+
+ #[cfg(feature = "services-onedrive")]
+ opendal_service_onedrive::register_onedrive_service(registry);
+
+ #[cfg(feature = "services-oss")]
+ opendal_service_oss::register_oss_service(registry);
+
+ #[cfg(feature = "services-pcloud")]
+ opendal_service_pcloud::register_pcloud_service(registry);
+
+ #[cfg(feature = "services-persy")]
+ opendal_service_persy::register_persy_service(registry);
+
+ #[cfg(feature = "services-postgresql")]
+ opendal_service_postgresql::register_postgresql_service(registry);
+
+ #[cfg(feature = "services-redb")]
+ opendal_service_redb::register_redb_service(registry);
+
+ #[cfg(feature = "services-rocksdb")]
+ opendal_service_rocksdb::register_rocksdb_service(registry);
+
+ #[cfg(feature = "services-s3")]
+ opendal_service_s3::register_s3_service(registry);
+
+ #[cfg(feature = "services-seafile")]
+ opendal_service_seafile::register_seafile_service(registry);
+
+ #[cfg(feature = "services-sftp")]
+ opendal_service_sftp::register_sftp_service(registry);
+
+ #[cfg(feature = "services-sled")]
+ opendal_service_sled::register_sled_service(registry);
+
+ #[cfg(feature = "services-sqlite")]
+ opendal_service_sqlite::register_sqlite_service(registry);
+
+ #[cfg(feature = "services-surrealdb")]
+ opendal_service_surrealdb::register_surrealdb_service(registry);
+
+ #[cfg(feature = "services-swift")]
+ opendal_service_swift::register_swift_service(registry);
+
+ #[cfg(feature = "services-tikv")]
+ opendal_service_tikv::register_tikv_service(registry);
+
+ #[cfg(feature = "services-upyun")]
+ opendal_service_upyun::register_upyun_service(registry);
+
+ #[cfg(feature = "services-vercel-artifacts")]
+
opendal_service_vercel_artifacts::register_vercel_artifacts_service(registry);
+
+ #[cfg(feature = "services-vercel-blob")]
+ opendal_service_vercel_blob::register_vercel_blob_service(registry);
+
+ #[cfg(feature = "services-webdav")]
+ opendal_service_webdav::register_webdav_service(registry);
+
+ #[cfg(feature = "services-webhdfs")]
+ opendal_service_webhdfs::register_webhdfs_service(registry);
+
+ #[cfg(feature = "services-yandex-disk")]
+ opendal_service_yandex_disk::register_yandex_disk_service(registry);
+
+ #[cfg(all(target_arch = "wasm32", feature = "services-opfs"))]
+ opendal_service_opfs::register_opfs_service(registry);
+
+ #[cfg(any(feature = "services-redis", feature =
"services-redis-native-tls"))]
+ opendal_service_redis::register_redis_service(registry);
+}
+
+#[ctor::ctor]
+fn register_default_operator_registry() {
+ init_default_registry();
+}
/// Re-export of service implementations.
pub mod services {