You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2025/06/04 11:12:55 UTC
(opendal) branch main updated: refactor(!): Remove services lack of maintainers and users (#6263)
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 75908a9e5 refactor(!): Remove services lack of maintainers and users (#6263)
75908a9e5 is described below
commit 75908a9e5dbafa1f1e94b65934e145fc97d8e1e5
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Wed Jun 4 19:12:50 2025 +0800
refactor(!): Remove services lack of maintainers and users (#6263)
Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
core/Cargo.lock | 188 +------
core/Cargo.toml | 8 -
core/README.md | 6 +-
core/src/raw/adapters/kv/api.rs | 1 -
core/src/raw/adapters/kv/mod.rs | 1 -
core/src/services/atomicserver/backend.rs | 431 ---------------
core/src/services/atomicserver/config.rs | 50 --
core/src/services/atomicserver/docs.md | 51 --
core/src/services/atomicserver/mod.rs | 24 -
core/src/services/icloud/backend.rs | 294 ----------
core/src/services/icloud/config.rs | 64 ---
core/src/services/icloud/core.rs | 879 ------------------------------
core/src/services/icloud/docs.md | 65 ---
core/src/services/icloud/mod.rs | 27 -
core/src/services/mod.rs | 9 -
core/src/services/nebula_graph/backend.rs | 401 --------------
core/src/services/nebula_graph/config.rs | 64 ---
core/src/services/nebula_graph/docs.md | 53 --
core/src/services/nebula_graph/mod.rs | 24 -
core/src/types/operator/builder.rs | 6 -
core/src/types/scheme.rs | 9 -
21 files changed, 3 insertions(+), 2652 deletions(-)
diff --git a/core/Cargo.lock b/core/Cargo.lock
index fd1cfc66d..04393b036 100644
--- a/core/Cargo.lock
+++ b/core/Cargo.lock
@@ -313,19 +313,6 @@ dependencies = [
"pin-project-lite",
]
-[[package]]
-name = "async-compat"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7bab94bde396a3f7b4962e396fdad640e241ed797d4d8d77fc8c237d14c58fc0"
-dependencies = [
- "futures-core",
- "futures-io",
- "once_cell",
- "pin-project-lite",
- "tokio",
-]
-
[[package]]
name = "async-executor"
version = "1.13.2"
@@ -478,16 +465,6 @@ dependencies = [
"syn 2.0.101",
]
-[[package]]
-name = "async-sleep"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c327a532ed3acb8ad885b50bb2ea5fc7c132a396dd990cf855d2825fbdc16c6c"
-dependencies = [
- "futures-util",
- "tokio",
-]
-
[[package]]
name = "async-std"
version = "1.13.1"
@@ -579,26 +556,6 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
-[[package]]
-name = "atomic_lib"
-version = "0.39.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e00b300ec3db6984694cd41cd84a738feeb4f6f916a13aa2ab733074319daecc"
-dependencies = [
- "base64 0.21.7",
- "rand 0.8.5",
- "regex",
- "ring",
- "serde",
- "serde_jcs",
- "serde_json",
- "tracing",
- "ulid",
- "ureq",
- "url",
- "urlencoding",
-]
-
[[package]]
name = "auto-const-array"
version = "0.2.2"
@@ -1202,12 +1159,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce"
-[[package]]
-name = "base64"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
-
[[package]]
name = "base64"
version = "0.13.1"
@@ -1491,15 +1442,6 @@ dependencies = [
"uuid",
]
-[[package]]
-name = "bufsize"
-version = "1.0.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06f23fe2eee7885e7e3294fd27e8ae7614ae25c1d5a006159e5e06fd84e15e6a"
-dependencies = [
- "bytes",
-]
-
[[package]]
name = "bumpalo"
version = "3.17.0"
@@ -2112,12 +2054,6 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf0a07a401f374238ab8e2f11a104d2851bf9ce711ec69804834de8af45c7af"
-[[package]]
-name = "const-cstr"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed3d0b5ff30645a68f35ece8cea4556ca14ef8a1651455f789a099a0513532a6"
-
[[package]]
name = "const-oid"
version = "0.9.6"
@@ -3039,16 +2975,6 @@ version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
-[[package]]
-name = "flate2"
-version = "1.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece"
-dependencies = [
- "crc32fast",
- "miniz_oxide",
-]
-
[[package]]
name = "flexstr"
version = "0.9.2"
@@ -3512,17 +3438,6 @@ dependencies = [
"prost 0.13.5",
]
-[[package]]
-name = "ghost"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a8661f18e73000bcea2f0d68262eb8ac1b1e951e10eb936d3f95b36201c136d"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.101",
-]
-
[[package]]
name = "gimli"
version = "0.31.1"
@@ -5325,17 +5240,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
-[[package]]
-name = "num-derive"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
[[package]]
name = "num-derive"
version = "0.4.2"
@@ -5439,7 +5343,6 @@ dependencies = [
"anyhow",
"async-backtrace",
"async-trait",
- "atomic_lib",
"await-tree",
"backon",
"base64 0.22.1",
@@ -5499,7 +5402,6 @@ dependencies = [
"reqsign",
"reqwest",
"rocksdb",
- "rust-nebula",
"rustls-native-certs 0.8.1",
"serde",
"serde_json",
@@ -5507,7 +5409,6 @@ dependencies = [
"sha2",
"size",
"sled",
- "snowflaked",
"sqlx",
"suppaftp",
"surrealdb",
@@ -5660,7 +5561,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9c862e0c56553146306507f55958c11ff554e02c46de287e6976e50d815b350"
dependencies = [
"bitflags 2.9.1",
- "num-derive 0.4.2",
+ "num-derive",
"num-traits",
"openssh-sftp-protocol-error",
"serde",
@@ -5799,16 +5700,6 @@ dependencies = [
"tokio-stream",
]
-[[package]]
-name = "ordered-float"
-version = "1.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7"
-dependencies = [
- "num-traits",
- "serde",
-]
-
[[package]]
name = "ordered-multimap"
version = "0.7.3"
@@ -5876,12 +5767,6 @@ dependencies = [
"sha2",
]
-[[package]]
-name = "panic-message"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "384e52fd8fbd4cbe3c317e8216260c21a0f9134de108cea8a4dd4e7e152c472d"
-
[[package]]
name = "parking"
version = "2.2.1"
@@ -7288,35 +7173,6 @@ dependencies = [
"trim-in-place",
]
-[[package]]
-name = "rust-nebula"
-version = "0.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "11a94ea754ca8b05b71ae911b7035180861cebb607c711acd766d14c04f87ae9"
-dependencies = [
- "anyhow",
- "async-compat",
- "async-sleep",
- "async-trait",
- "base64 0.11.0",
- "bb8",
- "bufsize",
- "bytes",
- "const-cstr",
- "futures",
- "futures-util",
- "ghost",
- "num-derive 0.3.3",
- "num-traits",
- "ordered-float",
- "panic-message",
- "serde",
- "serde_json",
- "thiserror 1.0.69",
- "tokio",
- "tracing",
-]
-
[[package]]
name = "rust-stemmers"
version = "1.2.0"
@@ -7529,12 +7385,6 @@ version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
-[[package]]
-name = "ryu-js"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f"
-
[[package]]
name = "salsa20"
version = "0.10.2"
@@ -7705,17 +7555,6 @@ dependencies = [
"syn 2.0.101",
]
-[[package]]
-name = "serde_jcs"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cacecf649bc1a7c5f0e299cc813977c6a78116abda2b93b1ee01735b71ead9a8"
-dependencies = [
- "ryu-js",
- "serde",
- "serde_json",
-]
-
[[package]]
name = "serde_json"
version = "1.0.140"
@@ -7960,15 +7799,6 @@ version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b"
-[[package]]
-name = "snowflaked"
-version = "1.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "398d462c4c454399be452039b24b0aa0ecb4c7a57f6ae615f5d25de2b032f850"
-dependencies = [
- "loom 0.5.6",
-]
-
[[package]]
name = "socket2"
version = "0.5.9"
@@ -9399,22 +9229,6 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
-[[package]]
-name = "ureq"
-version = "2.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d"
-dependencies = [
- "base64 0.22.1",
- "flate2",
- "log",
- "once_cell",
- "rustls 0.23.27",
- "rustls-pki-types",
- "url",
- "webpki-roots 0.26.11",
-]
-
[[package]]
name = "url"
version = "2.5.4"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 7363f7a10..b9fcd3d89 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -110,7 +110,6 @@ layers-dtrace = ["dep:probe"]
services-aliyun-drive = []
services-alluxio = []
-services-atomicserver = ["dep:atomic_lib"]
services-azblob = [
"dep:sha2",
"dep:reqsign",
@@ -162,7 +161,6 @@ services-hdfs = ["dep:hdrs"]
services-hdfs-native = ["hdfs-native"]
services-http = []
services-huggingface = []
-services-icloud = ["internal-path-cache"]
services-ipfs = ["dep:prost"]
services-ipmfs = []
services-koofr = []
@@ -174,7 +172,6 @@ services-moka = ["dep:moka"]
services-mongodb = ["dep:mongodb", "dep:mongodb-internal-macros"]
services-monoiofs = ["dep:monoio", "dep:flume"]
services-mysql = ["dep:sqlx", "sqlx?/mysql"]
-services-nebula-graph = ["dep:rust-nebula", "dep:bb8", "dep:snowflaked"]
services-obs = [
"dep:reqsign",
"reqsign?/services-huaweicloud",
@@ -289,8 +286,6 @@ reqsign = { version = "0.16.3", default-features = false, optional = true }
# for self-referencing structs
ouroboros = { version = "0.18.4", optional = true }
-# for services-atomic-server
-atomic_lib = { version = "0.39.0", optional = true }
# for services-cacache
cacache = { version = "13.0", default-features = false, features = [
"tokio-runtime",
@@ -359,9 +354,6 @@ compio = { version = "0.14.0", optional = true, features = [
] }
# for services-s3
crc32c = { version = "0.6.6", optional = true }
-# for services-nebula-graph
-rust-nebula = { version = "^0.0.2", optional = true, features = ["graph"] }
-snowflaked = { version = "1", optional = true, features = ["sync"] }
# for services-monoiofs
flume = { version = "0.11", optional = true }
monoio = { version = "0.2.4", optional = true, features = [
diff --git a/core/README.md b/core/README.md
index 0b4ed24d6..9a103a4fc 100644
--- a/core/README.md
+++ b/core/README.md
@@ -31,8 +31,8 @@ OpenDAL supports the following storage [services](https://docs.rs/opendal/latest
| Standard Storage Protocols | ftp http [sftp] [webdav] |
| Object Storage Services | [azblob] [cos] [gcs] [obs] [oss] [s3] <br> [b2] [openstack_swift] [upyun] [vercel_blob] |
| File Storage Services | fs [alluxio] [azdls] [azfile] [compfs] <br> [dbfs] [gridfs] [hdfs] [hdfs_native] [ipfs] [webhdfs] |
-| Consumer Cloud Storage Service | [aliyun_drive] [gdrive] [onedrive] [dropbox] [icloud] [koofr] <br> [pcloud] [seafile] [yandex_disk] |
-| Key-Value Storage Services | [cacache] [cloudflare_kv] [dashmap] memory [etcd] <br> [foundationdb] [persy] [redis] [rocksdb] [sled] <br> [redb] [tikv] [atomicserver] |
+| Consumer Cloud Storage Service | [aliyun_drive] [gdrive] [onedrive] [dropbox] [koofr] <br> [pcloud] [seafile] [yandex_disk] |
+| Key-Value Storage Services | [cacache] [cloudflare_kv] [dashmap] memory [etcd] <br> [foundationdb] [persy] [redis] [rocksdb] [sled] <br> [redb] [tikv] |
| Database Storage Services | [d1] [mongodb] [mysql] [postgresql] [sqlite] [surrealdb] |
| Cache Storage Services | [ghac] [memcached] [mini_moka] [moka] [vercel_artifacts] |
| Git Based Storage Services | [huggingface] |
@@ -66,7 +66,6 @@ OpenDAL supports the following storage [services](https://docs.rs/opendal/latest
[gdrive]: https://www.google.com/drive/
[onedrive]: https://www.microsoft.com/en-us/microsoft-365/onedrive/online-cloud-storage
[dropbox]: https://www.dropbox.com/
-[icloud]: https://www.icloud.com/iclouddrive
[koofr]: https://koofr.eu/
[pcloud]: https://www.pcloud.com/
[seafile]: https://www.seafile.com/
@@ -83,7 +82,6 @@ OpenDAL supports the following storage [services](https://docs.rs/opendal/latest
[sled]: https://crates.io/crates/sled
[redb]: https://crates.io/crates/redb
[tikv]: https://tikv.org/
-[atomicserver]: https://github.com/atomicdata-dev/atomic-server
[d1]: https://developers.cloudflare.com/d1/
[mongodb]: https://www.mongodb.com/
diff --git a/core/src/raw/adapters/kv/api.rs b/core/src/raw/adapters/kv/api.rs
index 282093ca0..f069464a0 100644
--- a/core/src/raw/adapters/kv/api.rs
+++ b/core/src/raw/adapters/kv/api.rs
@@ -47,7 +47,6 @@ pub struct ScanStdIter<I>(I);
#[cfg(any(
feature = "services-cloudflare-kv",
feature = "services-etcd",
- feature = "services-nebula-graph",
feature = "services-rocksdb",
feature = "services-sled"
))]
diff --git a/core/src/raw/adapters/kv/mod.rs b/core/src/raw/adapters/kv/mod.rs
index 719925160..9d66eb55c 100644
--- a/core/src/raw/adapters/kv/mod.rs
+++ b/core/src/raw/adapters/kv/mod.rs
@@ -26,7 +26,6 @@ pub use api::Scan;
#[cfg(any(
feature = "services-cloudflare-kv",
feature = "services-etcd",
- feature = "services-nebula-graph",
feature = "services-rocksdb",
feature = "services-sled"
))]
diff --git a/core/src/services/atomicserver/backend.rs b/core/src/services/atomicserver/backend.rs
deleted file mode 100644
index 5683cfea0..000000000
--- a/core/src/services/atomicserver/backend.rs
+++ /dev/null
@@ -1,431 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-use std::fmt::Debug;
-use std::fmt::Formatter;
-
-use atomic_lib::agents::Agent;
-use atomic_lib::client::get_authentication_headers;
-use atomic_lib::commit::sign_message;
-use bytes::Buf;
-use http::header::CONTENT_DISPOSITION;
-use http::header::CONTENT_TYPE;
-use http::Request;
-use serde::Deserialize;
-use serde::Serialize;
-
-use crate::raw::adapters::kv;
-use crate::raw::*;
-use crate::services::AtomicserverConfig;
-use crate::*;
-
-impl Configurator for AtomicserverConfig {
- type Builder = AtomicserverBuilder;
- fn into_builder(self) -> Self::Builder {
- AtomicserverBuilder { config: self }
- }
-}
-
-#[doc = include_str!("docs.md")]
-#[derive(Default)]
-pub struct AtomicserverBuilder {
- config: AtomicserverConfig,
-}
-
-impl Debug for AtomicserverBuilder {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- f.debug_struct("AtomicserverBuilder")
- .field("config", &self.config)
- .finish()
- }
-}
-
-impl AtomicserverBuilder {
- /// Set the root for Atomicserver.
- pub fn root(mut self, path: &str) -> Self {
- self.config.root = Some(path.into());
- self
- }
-
- /// Set the server address for Atomicserver.
- pub fn endpoint(mut self, endpoint: &str) -> Self {
- self.config.endpoint = Some(endpoint.into());
- self
- }
-
- /// Set the private key for agent used for Atomicserver.
- pub fn private_key(mut self, private_key: &str) -> Self {
- self.config.private_key = Some(private_key.into());
- self
- }
-
- /// Set the public key for agent used for Atomicserver.
- /// For example, if the subject URL for the agent being used
- /// is ${endpoint}/agents/lTB+W3C/2YfDu9IAVleEy34uCmb56iXXuzWCKBVwdRI=
- /// Then the required public key is `lTB+W3C/2YfDu9IAVleEy34uCmb56iXXuzWCKBVwdRI=`
- pub fn public_key(mut self, public_key: &str) -> Self {
- self.config.public_key = Some(public_key.into());
- self
- }
-
- /// Set the parent resource id (url) that Atomicserver uses to store resources under.
- pub fn parent_resource_id(mut self, parent_resource_id: &str) -> Self {
- self.config.parent_resource_id = Some(parent_resource_id.into());
- self
- }
-}
-
-impl Builder for AtomicserverBuilder {
- const SCHEME: Scheme = Scheme::Atomicserver;
- type Config = AtomicserverConfig;
-
- fn build(self) -> Result<impl Access> {
- let root = normalize_root(
- self.config
- .root
- .clone()
- .unwrap_or_else(|| "/".to_string())
- .as_str(),
- );
-
- let endpoint = self.config.endpoint.clone().unwrap();
- let parent_resource_id = self.config.parent_resource_id.clone().unwrap();
-
- let agent = Agent {
- private_key: self.config.private_key.clone(),
- public_key: self.config.public_key.clone().unwrap(),
- subject: format!(
- "{}/agents/{}",
- endpoint,
- self.config.public_key.clone().unwrap()
- ),
- created_at: 1,
- name: Some("agent".to_string()),
- };
-
- Ok(AtomicserverBackend::new(Adapter {
- parent_resource_id,
- endpoint,
- agent,
- client: HttpClient::new().map_err(|err| {
- err.with_operation("Builder::build")
- .with_context("service", Scheme::Atomicserver)
- })?,
- })
- .with_normalized_root(root))
- }
-}
-
-/// Backend for Atomicserver services.
-pub type AtomicserverBackend = kv::Backend<Adapter>;
-
-const FILENAME_PROPERTY: &str = "https://atomicdata.dev/properties/filename";
-
-#[derive(Debug, Serialize)]
-struct CommitStruct {
- #[serde(rename = "https://atomicdata.dev/properties/createdAt")]
- created_at: i64,
- #[serde(rename = "https://atomicdata.dev/properties/destroy")]
- destroy: bool,
- #[serde(rename = "https://atomicdata.dev/properties/isA")]
- is_a: Vec<String>,
- #[serde(rename = "https://atomicdata.dev/properties/signer")]
- signer: String,
- #[serde(rename = "https://atomicdata.dev/properties/subject")]
- subject: String,
-}
-
-#[derive(Debug, Serialize)]
-struct CommitStructSigned {
- #[serde(rename = "https://atomicdata.dev/properties/createdAt")]
- created_at: i64,
- #[serde(rename = "https://atomicdata.dev/properties/destroy")]
- destroy: bool,
- #[serde(rename = "https://atomicdata.dev/properties/isA")]
- is_a: Vec<String>,
- #[serde(rename = "https://atomicdata.dev/properties/signature")]
- signature: String,
- #[serde(rename = "https://atomicdata.dev/properties/signer")]
- signer: String,
- #[serde(rename = "https://atomicdata.dev/properties/subject")]
- subject: String,
-}
-
-#[derive(Debug, Deserialize)]
-struct FileStruct {
- #[serde(rename = "@id")]
- id: String,
- #[serde(rename = "https://atomicdata.dev/properties/downloadURL")]
- download_url: String,
-}
-
-#[derive(Debug, Deserialize)]
-struct QueryResultStruct {
- #[serde(
- rename = "https://atomicdata.dev/properties/endpoint/results",
- default = "empty_vec"
- )]
- results: Vec<FileStruct>,
-}
-
-fn empty_vec() -> Vec<FileStruct> {
- Vec::new()
-}
-
-#[derive(Clone)]
-pub struct Adapter {
- parent_resource_id: String,
- endpoint: String,
- agent: Agent,
- client: HttpClient,
-}
-
-impl Debug for Adapter {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- let mut ds = f.debug_struct("Adapter");
- ds.finish()
- }
-}
-
-impl Adapter {
- fn sign(&self, url: &str, mut req: http::request::Builder) -> http::request::Builder {
- let auth_headers = get_authentication_headers(url, &self.agent)
- .map_err(|err| {
- Error::new(
- ErrorKind::Unexpected,
- "Failed to get authentication headers",
- )
- .with_context("service", Scheme::Atomicserver)
- .set_source(err)
- })
- .unwrap();
-
- for (k, v) in &auth_headers {
- req = req.header(k, v);
- }
-
- req
- }
-}
-
-impl Adapter {
- pub fn atomic_get_object_request(&self, path: &str) -> Result<Request<Buffer>> {
- let path = normalize_path(path);
- let path = path.as_str();
-
- let filename_property_escaped = FILENAME_PROPERTY.replace(':', "\\:").replace('.', "\\.");
- let url = format!(
- "{}/search?filters={}:%22{}%22",
- self.endpoint,
- percent_encode_path(&filename_property_escaped),
- percent_encode_path(path)
- );
-
- let mut req = Request::get(&url);
- req = self.sign(&url, req);
- req = req.header(http::header::ACCEPT, "application/ad+json");
-
- let req = req.body(Buffer::new()).map_err(new_request_build_error)?;
-
- Ok(req)
- }
-
- fn atomic_post_object_request(&self, path: &str, value: Buffer) -> Result<Request<Buffer>> {
- let path = normalize_path(path);
- let path = path.as_str();
-
- let url = format!(
- "{}/upload?parent={}",
- self.endpoint,
- percent_encode_path(&self.parent_resource_id)
- );
-
- let mut req = Request::post(&url);
- req = self.sign(&url, req);
-
- let datapart = FormDataPart::new("assets")
- .header(
- CONTENT_DISPOSITION,
- format!("form-data; name=\"assets\"; filename=\"{}\"", path)
- .parse()
- .unwrap(),
- )
- .header(CONTENT_TYPE, "text/plain".parse().unwrap())
- .content(value.to_vec());
-
- let multipart = Multipart::new().part(datapart);
- let req = multipart.apply(req)?;
-
- Ok(req)
- }
-
- pub fn atomic_delete_object_request(&self, subject: &str) -> Result<Request<Buffer>> {
- let url = format!("{}/commit", self.endpoint);
-
- let timestamp = std::time::SystemTime::now()
- .duration_since(std::time::UNIX_EPOCH)
- .expect("You're a time traveler")
- .as_millis() as i64;
-
- let commit_to_sign = CommitStruct {
- created_at: timestamp,
- destroy: true,
- is_a: ["https://atomicdata.dev/classes/Commit".to_string()].to_vec(),
- signer: self.agent.subject.to_string(),
- subject: subject.to_string().clone(),
- };
- let commit_sign_string =
- serde_json::to_string(&commit_to_sign).map_err(new_json_serialize_error)?;
-
- let signature = sign_message(
- &commit_sign_string,
- self.agent.private_key.as_ref().unwrap(),
- &self.agent.public_key,
- )
- .unwrap();
-
- let commit = CommitStructSigned {
- created_at: timestamp,
- destroy: true,
- is_a: ["https://atomicdata.dev/classes/Commit".to_string()].to_vec(),
- signature,
- signer: self.agent.subject.to_string(),
- subject: subject.to_string().clone(),
- };
-
- let req = Request::post(&url);
- let body_string = serde_json::to_string(&commit).map_err(new_json_serialize_error)?;
-
- let body_bytes = body_string.as_bytes().to_owned();
- let req = req
- .body(Buffer::from(body_bytes))
- .map_err(new_request_build_error)?;
-
- Ok(req)
- }
-
- pub async fn download_from_url(&self, download_url: &String) -> Result<Buffer> {
- let req = Request::get(download_url);
- let req = req.body(Buffer::new()).map_err(new_request_build_error)?;
- let resp = self.client.send(req).await?;
- Ok(resp.into_body())
- }
-}
-
-impl Adapter {
- async fn wait_for_resource(&self, path: &str, expect_exist: bool) -> Result<()> {
- // This is used to wait until insert/delete is actually effective
- // This wait function is needed because atomicserver commits are not processed in real-time
- // See https://docs.atomicdata.dev/commits/intro.html#motivation
- for _i in 0..1000 {
- let req = self.atomic_get_object_request(path)?;
- let resp = self.client.send(req).await?;
- let bytes = resp.into_body();
- let query_result: QueryResultStruct =
- serde_json::from_reader(bytes.reader()).map_err(new_json_deserialize_error)?;
- if !expect_exist && query_result.results.is_empty() {
- break;
- }
- if expect_exist && !query_result.results.is_empty() {
- break;
- }
- std::thread::sleep(std::time::Duration::from_millis(30));
- }
-
- Ok(())
- }
-}
-
-impl kv::Adapter for Adapter {
- type Scanner = ();
-
- fn info(&self) -> kv::Info {
- kv::Info::new(
- Scheme::Atomicserver,
- "atomicserver",
- Capability {
- read: true,
- write: true,
- delete: true,
- shared: true,
- ..Default::default()
- },
- )
- }
-
- async fn get(&self, path: &str) -> Result<Option<Buffer>> {
- let req = self.atomic_get_object_request(path)?;
- let resp = self.client.send(req).await?;
- let bytes = resp.into_body();
-
- let query_result: QueryResultStruct =
- serde_json::from_reader(bytes.reader()).map_err(new_json_deserialize_error)?;
-
- if query_result.results.is_empty() {
- return Err(Error::new(
- ErrorKind::NotFound,
- "atomicserver: key not found",
- ));
- }
-
- let bytes_file = self
- .download_from_url(&query_result.results[0].download_url)
- .await?;
-
- Ok(Some(bytes_file))
- }
-
- async fn set(&self, path: &str, value: Buffer) -> Result<()> {
- let req = self.atomic_get_object_request(path)?;
- let res = self.client.send(req).await?;
- let bytes = res.into_body();
-
- let query_result: QueryResultStruct =
- serde_json::from_reader(bytes.reader()).map_err(new_json_deserialize_error)?;
-
- for result in query_result.results {
- let req = self.atomic_delete_object_request(&result.id)?;
- let _res = self.client.send(req).await?;
- }
-
- let _ = self.wait_for_resource(path, false).await;
-
- let req = self.atomic_post_object_request(path, value)?;
- let _res = self.client.send(req).await?;
- let _ = self.wait_for_resource(path, true).await;
-
- Ok(())
- }
-
- async fn delete(&self, path: &str) -> Result<()> {
- let req = self.atomic_get_object_request(path)?;
- let res = self.client.send(req).await?;
- let bytes = res.into_body();
-
- let query_result: QueryResultStruct =
- serde_json::from_reader(bytes.reader()).map_err(new_json_deserialize_error)?;
-
- for result in query_result.results {
- let req = self.atomic_delete_object_request(&result.id)?;
- let _res = self.client.send(req).await?;
- }
-
- let _ = self.wait_for_resource(path, false).await;
-
- Ok(())
- }
-}
diff --git a/core/src/services/atomicserver/config.rs b/core/src/services/atomicserver/config.rs
deleted file mode 100644
index 5d015b65b..000000000
--- a/core/src/services/atomicserver/config.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-use std::fmt::Debug;
-use std::fmt::Formatter;
-
-use serde::Deserialize;
-use serde::Serialize;
-
-/// Config for Atomicserver services support
-#[derive(Default, Serialize, Deserialize, Clone, PartialEq, Eq)]
-#[serde(default)]
-#[non_exhaustive]
-pub struct AtomicserverConfig {
- /// work dir of this backend
- pub root: Option<String>,
- /// endpoint of this backend
- pub endpoint: Option<String>,
- /// private_key of this backend
- pub private_key: Option<String>,
- /// public_key of this backend
- pub public_key: Option<String>,
- /// parent_resource_id of this backend
- pub parent_resource_id: Option<String>,
-}
-
-impl Debug for AtomicserverConfig {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- f.debug_struct("AtomicserverConfig")
- .field("root", &self.root)
- .field("endpoint", &self.endpoint)
- .field("public_key", &self.public_key)
- .field("parent_resource_id", &self.parent_resource_id)
- .finish_non_exhaustive()
- }
-}
diff --git a/core/src/services/atomicserver/docs.md b/core/src/services/atomicserver/docs.md
deleted file mode 100644
index c22260f4b..000000000
--- a/core/src/services/atomicserver/docs.md
+++ /dev/null
@@ -1,51 +0,0 @@
-## Capabilities
-
-This service can be used to:
-
-- [x] stat
-- [x] read
-- [x] write
-- [x] create_dir
-- [x] delete
-- [x] copy
-- [x] rename
-- [ ] ~~list~~
-- [ ] ~~presign~~
-- [ ] blocking
-
-
-## Configuration
-
-- `root`: Set the working directory of `OpenDAL`
-- `endpoint`: Set the server address for `Atomicserver`
-- `private_key`: Set the private key for agent used for `Atomicserver`
-- `public_key`: Set the public key for agent used for `Atomicserver`
-- `parent_resource_id`: Set the parent resource id (url) that `Atomicserver` uses to store resources under
-
-You can refer to [`AtomicserverBuilder`]'s docs for more information.
-
-## Example
-
-### Via Builder
-
-```rust,no_run
-use anyhow::Result;
-use opendal::services::Atomicserver;
-use opendal::Operator;
-
-#[tokio::main]
-async fn main() -> Result<()> {
- let mut builder = Atomicserver::default()
- // Set the server address for Atomicserver
- .endpoint("http://localhost:9883")
- // Set the public/private key for agent for Atomicserver
- .private_key("<private_key>")
- .public_key("<public_key>")
- // Set the parent resource id for Atomicserver. In this case
- // We are using the root resource (Drive)
- .parent_resource_id("http://localhost:9883");
-
- let op: Operator = Operator::new(builder)?.finish();
- Ok(())
-}
-```
diff --git a/core/src/services/atomicserver/mod.rs b/core/src/services/atomicserver/mod.rs
deleted file mode 100644
index b1e3ea4f3..000000000
--- a/core/src/services/atomicserver/mod.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#[cfg(feature = "services-atomicserver")]
-mod backend;
-#[cfg(feature = "services-atomicserver")]
-pub use backend::AtomicserverBuilder as Atomicserver;
-
-mod config;
-pub use config::AtomicserverConfig;
diff --git a/core/src/services/icloud/backend.rs b/core/src/services/icloud/backend.rs
deleted file mode 100644
index 6377c3dde..000000000
--- a/core/src/services/icloud/backend.rs
+++ /dev/null
@@ -1,294 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-use std::fmt::Debug;
-use std::fmt::Formatter;
-use std::sync::Arc;
-
-use http::Response;
-use http::StatusCode;
-use tokio::sync::Mutex;
-
-use super::core::*;
-use crate::raw::*;
-use crate::services::IcloudConfig;
-use crate::*;
-
-impl Configurator for IcloudConfig {
- type Builder = IcloudBuilder;
-
- #[allow(deprecated)]
- fn into_builder(self) -> Self::Builder {
- IcloudBuilder {
- config: self,
- http_client: None,
- }
- }
-}
-
-/// [IcloudDrive](https://www.icloud.com/iclouddrive/) service support.
-#[doc = include_str!("docs.md")]
-#[derive(Default)]
-pub struct IcloudBuilder {
- /// icloud config for web session request
- pub config: IcloudConfig,
- /// Specify the http client that used by this service.
- ///
- /// # Notes
- ///
- /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
- /// during minor updates.
- #[deprecated(since = "0.53.0", note = "Use `Operator::update_http_client` instead")]
- pub http_client: Option<HttpClient>,
-}
-
-impl Debug for IcloudBuilder {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- let mut d = f.debug_struct("IcloudBuilder");
-
- d.field("config", &self.config);
- d.finish_non_exhaustive()
- }
-}
-
-impl IcloudBuilder {
- /// Set root of this backend.
- ///
- /// All operations will happen under this root.
- pub fn root(mut self, root: &str) -> Self {
- self.config.root = if root.is_empty() {
- None
- } else {
- Some(root.to_string())
- };
-
- self
- }
-
- /// Your Apple id
- ///
- /// It is required. your Apple login email, e.g. `example@gmail.com`
- pub fn apple_id(mut self, apple_id: &str) -> Self {
- self.config.apple_id = if apple_id.is_empty() {
- None
- } else {
- Some(apple_id.to_string())
- };
-
- self
- }
-
- /// Your Apple id password
- ///
- /// It is required. your icloud login password, e.g. `password`
- pub fn password(mut self, password: &str) -> Self {
- self.config.password = if password.is_empty() {
- None
- } else {
- Some(password.to_string())
- };
-
- self
- }
-
- /// Trust token and ds_web_auth_token is used for temporary access to the icloudDrive API.
- ///
- /// Authenticate using session token
- pub fn trust_token(mut self, trust_token: &str) -> Self {
- self.config.trust_token = if trust_token.is_empty() {
- None
- } else {
- Some(trust_token.to_string())
- };
-
- self
- }
-
- /// ds_web_auth_token must be set in Session
- ///
- /// Avoid Two Factor Authentication
- pub fn ds_web_auth_token(mut self, ds_web_auth_token: &str) -> Self {
- self.config.ds_web_auth_token = if ds_web_auth_token.is_empty() {
- None
- } else {
- Some(ds_web_auth_token.to_string())
- };
-
- self
- }
-
- /// Set if your apple id in China mainland.
- ///
- /// If in china mainland, we will connect to `https://www.icloud.com.cn`.
- /// Otherwise, we will connect to `https://www.icloud.com`.
- pub fn is_china_mainland(mut self, is_china_mainland: bool) -> Self {
- self.config.is_china_mainland = is_china_mainland;
- self
- }
-
- /// Specify the http client that used by this service.
- ///
- /// # Notes
- ///
- /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
- /// during minor updates.
- #[deprecated(since = "0.53.0", note = "Use `Operator::update_http_client` instead")]
- #[allow(deprecated)]
- pub fn http_client(mut self, client: HttpClient) -> Self {
- self.http_client = Some(client);
- self
- }
-}
-
-impl Builder for IcloudBuilder {
- const SCHEME: Scheme = Scheme::Icloud;
- type Config = IcloudConfig;
-
- fn build(self) -> Result<impl Access> {
- let root = normalize_root(&self.config.root.unwrap_or_default());
-
- let apple_id = match &self.config.apple_id {
- Some(apple_id) => Ok(apple_id.clone()),
- None => Err(Error::new(ErrorKind::ConfigInvalid, "apple_id is empty")
- .with_operation("Builder::build")
- .with_context("service", Scheme::Icloud)),
- }?;
-
- let password = match &self.config.password {
- Some(password) => Ok(password.clone()),
- None => Err(Error::new(ErrorKind::ConfigInvalid, "password is empty")
- .with_operation("Builder::build")
- .with_context("service", Scheme::Icloud)),
- }?;
-
- let ds_web_auth_token = match &self.config.ds_web_auth_token {
- Some(ds_web_auth_token) => Ok(ds_web_auth_token.clone()),
- None => Err(
- Error::new(ErrorKind::ConfigInvalid, "ds_web_auth_token is empty")
- .with_operation("Builder::build")
- .with_context("service", Scheme::Icloud),
- ),
- }?;
-
- let trust_token = match &self.config.trust_token {
- Some(trust_token) => Ok(trust_token.clone()),
- None => Err(Error::new(ErrorKind::ConfigInvalid, "trust_token is empty")
- .with_operation("Builder::build")
- .with_context("service", Scheme::Icloud)),
- }?;
-
- let session_data = SessionData::new();
-
- let info = AccessorInfo::default();
- info.set_scheme(Scheme::Icloud)
- .set_root(&root)
- .set_native_capability(Capability {
- stat: true,
- stat_has_content_length: true,
- stat_has_last_modified: true,
-
- read: true,
-
- shared: true,
- ..Default::default()
- });
-
- // allow deprecated api here for compatibility
- #[allow(deprecated)]
- if let Some(client) = self.http_client {
- info.update_http_client(|_| client);
- }
-
- let accessor_info = Arc::new(info);
-
- let signer = IcloudSigner {
- info: accessor_info.clone(),
- data: session_data,
- apple_id,
- password,
- trust_token: Some(trust_token),
- ds_web_auth_token: Some(ds_web_auth_token),
- is_china_mainland: self.config.is_china_mainland,
- initiated: false,
- };
-
- let signer = Arc::new(Mutex::new(signer));
- Ok(IcloudBackend {
- core: Arc::new(IcloudCore {
- info: accessor_info,
- signer: signer.clone(),
- root,
- path_cache: PathCacher::new(IcloudPathQuery::new(signer.clone())),
- }),
- })
- }
-}
-
-#[derive(Debug, Clone)]
-pub struct IcloudBackend {
- core: Arc<IcloudCore>,
-}
-
-impl Access for IcloudBackend {
- type Reader = HttpBody;
- type Writer = ();
- type Lister = ();
- type Deleter = ();
-
- fn info(&self) -> Arc<AccessorInfo> {
- self.core.info.clone()
- }
-
- async fn stat(&self, path: &str, _: OpStat) -> Result<RpStat> {
- // icloud get the filename by id, instead obtain the metadata by filename
- if path == "/" {
- return Ok(RpStat::new(Metadata::new(EntryMode::DIR)));
- }
-
- let node = self.core.stat(path).await?;
-
- let mut meta = Metadata::new(match node.type_field.as_str() {
- "FOLDER" => EntryMode::DIR,
- _ => EntryMode::FILE,
- });
-
- if meta.mode() == EntryMode::DIR || path.ends_with('/') {
- return Ok(RpStat::new(Metadata::new(EntryMode::DIR)));
- }
-
- meta = meta.with_content_length(node.size);
-
- let last_modified = parse_datetime_from_rfc3339(&node.date_modified)?;
- meta = meta.with_last_modified(last_modified);
-
- Ok(RpStat::new(meta))
- }
-
- async fn read(&self, path: &str, args: OpRead) -> Result<(RpRead, Self::Reader)> {
- let resp = self.core.read(path, args.range(), &args).await?;
-
- let status = resp.status();
- match status {
- StatusCode::OK | StatusCode::PARTIAL_CONTENT => Ok((RpRead::new(), resp.into_body())),
- _ => {
- let (part, mut body) = resp.into_parts();
- let buf = body.to_buffer().await?;
- Err(parse_error(Response::from_parts(part, buf)))
- }
- }
- }
-}
diff --git a/core/src/services/icloud/config.rs b/core/src/services/icloud/config.rs
deleted file mode 100644
index c4f16c8c4..000000000
--- a/core/src/services/icloud/config.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-use std::fmt::Debug;
-use std::fmt::Formatter;
-
-use serde::Deserialize;
-use serde::Serialize;
-
-/// Config for icloud services support.
-#[derive(Default, Serialize, Deserialize, Clone, PartialEq, Eq)]
-#[serde(default)]
-#[non_exhaustive]
-pub struct IcloudConfig {
- /// root of this backend.
- ///
- /// All operations will happen under this root.
- ///
- /// default to `/` if not set.
- pub root: Option<String>,
- /// apple_id of this backend.
- ///
- /// apple_id must be full, mostly like `example@gmail.com`.
- pub apple_id: Option<String>,
- /// password of this backend.
- ///
- /// password must be full.
- pub password: Option<String>,
-
- /// Session
- ///
- /// token must be valid.
- pub trust_token: Option<String>,
- /// ds_web_auth_token must be set in Session
- pub ds_web_auth_token: Option<String>,
- /// enable the china origin
- /// China region `origin` Header needs to be set to "https://www.icloud.com.cn".
- ///
- /// otherwise Apple server will return 302.
- pub is_china_mainland: bool,
-}
-
-impl Debug for IcloudConfig {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- let mut d = f.debug_struct("IcloudBuilder");
- d.field("root", &self.root);
- d.field("is_china_mainland", &self.is_china_mainland);
- d.finish_non_exhaustive()
- }
-}
diff --git a/core/src/services/icloud/core.rs b/core/src/services/icloud/core.rs
deleted file mode 100644
index a31957eda..000000000
--- a/core/src/services/icloud/core.rs
+++ /dev/null
@@ -1,879 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-use std::collections::BTreeMap;
-use std::fmt::Debug;
-use std::fmt::Formatter;
-use std::sync::Arc;
-
-use bytes::Buf;
-use bytes::Bytes;
-use http::header;
-use http::header::IF_MATCH;
-use http::header::IF_NONE_MATCH;
-use http::Request;
-use http::Response;
-use http::StatusCode;
-use serde::Deserialize;
-use serde::Serialize;
-use serde_json::json;
-use tokio::sync::Mutex;
-
-use crate::raw::*;
-use crate::*;
-
-static ACCOUNT_COUNTRY_HEADER: &str = "X-Apple-ID-Account-Country";
-static OAUTH_STATE_HEADER: &str = "X-Apple-OAuth-State";
-static SESSION_ID_HEADER: &str = "X-Apple-ID-Session-Id";
-static SCNT_HEADER: &str = "scnt";
-static SESSION_TOKEN_HEADER: &str = "X-Apple-Session-Token";
-static APPLE_RESPONSE_HEADER: &str = "X-Apple-I-Rscd";
-
-static AUTH_ENDPOINT: &str = "https://idmsa.apple.com/appleauth/auth";
-static SETUP_ENDPOINT: &str = "https://setup.icloud.com/setup/ws/1";
-
-const AUTH_HEADERS: [(&str, &str); 7] = [
- (
- // This code inspire from
- // https://github.com/picklepete/pyicloud/blob/master/pyicloud/base.py#L392
- "X-Apple-OAuth-Client-Id",
- "d39ba9916b7251055b22c7f910e2ea796ee65e98b2ddecea8f5dde8d9d1a815d",
- ),
- ("X-Apple-OAuth-Client-Type", "firstPartyAuth"),
- ("X-Apple-OAuth-Redirect-URI", "https://www.icloud.com"),
- ("X-Apple-OAuth-Require-Grant-Code", "true"),
- ("X-Apple-OAuth-Response-Mode", "web_message"),
- ("X-Apple-OAuth-Response-Type", "code"),
- (
- "X-Apple-Widget-Key",
- "d39ba9916b7251055b22c7f910e2ea796ee65e98b2ddecea8f5dde8d9d1a815d",
- ),
-];
-
-#[derive(Clone)]
-pub struct SessionData {
- oauth_state: String,
- session_id: Option<String>,
- session_token: Option<String>,
-
- scnt: Option<String>,
- account_country: Option<String>,
- cookies: BTreeMap<String, String>,
- drivews_url: String,
- docws_url: String,
-}
-
-impl Default for SessionData {
- fn default() -> Self {
- Self::new()
- }
-}
-
-impl SessionData {
- pub fn new() -> SessionData {
- Self {
- oauth_state: format!("auth-{}", uuid::Uuid::new_v4()).to_string(),
- session_id: None,
- session_token: None,
- scnt: None,
- account_country: None,
-
- cookies: BTreeMap::default(),
- drivews_url: String::new(),
- docws_url: String::new(),
- }
- }
-}
-
-#[derive(Clone)]
-pub struct IcloudSigner {
- pub info: Arc<AccessorInfo>,
-
- pub apple_id: String,
- pub password: String,
- pub is_china_mainland: bool,
- pub trust_token: Option<String>,
- pub ds_web_auth_token: Option<String>,
-
- pub data: SessionData,
- pub initiated: bool,
-}
-
-impl Debug for IcloudSigner {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- let mut de = f.debug_struct("icloud signer");
- de.field("is_china_mainland", &self.is_china_mainland);
- de.finish()
- }
-}
-
-impl IcloudSigner {
- /// Get the drivews_url from signer session data.
- /// Async await init finish.
- pub async fn drivews_url(&mut self) -> Result<&str> {
- self.init().await?;
- Ok(&self.data.drivews_url)
- }
-
- /// Get the docws_url from signer session data.
- /// Async await init finish.
- pub async fn docws_url(&mut self) -> Result<&str> {
- self.init().await?;
- Ok(&self.data.docws_url)
- }
-
- /// iCloud will use our oauth state as client id.
- pub fn client_id(&self) -> &str {
- &self.data.oauth_state
- }
-
- async fn init(&mut self) -> Result<()> {
- if self.initiated {
- return Ok(());
- }
-
- // Sign the auth endpoint first.
- let uri = format!("{}/signin?isRememberMeEnable=true", AUTH_ENDPOINT);
- let body = serde_json::to_vec(&json!({
- "accountName" : self.apple_id,
- "password" : self.password,
- "rememberMe": true,
- "trustTokens": [self.trust_token.clone().unwrap()],
- }))
- .map_err(new_json_serialize_error)?;
-
- let mut req = Request::post(uri)
- .header(header::CONTENT_TYPE, "application/json")
- .body(Buffer::from(Bytes::from(body)))
- .map_err(new_request_build_error)?;
- self.sign(&mut req)?;
-
- let resp = self.info.http_client().send(req).await?;
- if resp.status() != StatusCode::OK {
- return Err(parse_error(resp));
- }
-
- if let Some(rscd) = resp.headers().get(APPLE_RESPONSE_HEADER) {
- let status_code = StatusCode::from_bytes(rscd.as_bytes()).unwrap();
- if status_code != StatusCode::CONFLICT {
- return Err(parse_error(resp));
- }
- }
-
- // Setup to get the session id.
- let uri = format!("{}/accountLogin", SETUP_ENDPOINT);
- let body = serde_json::to_vec(&json!({
- "accountCountryCode": self.data.account_country.clone().unwrap_or_default(),
- "dsWebAuthToken":self.ds_web_auth_token.clone().unwrap_or_default(),
- "extended_login": true,
- "trustToken": self.trust_token.clone().unwrap_or_default(),}))
- .map_err(new_json_serialize_error)?;
-
- let mut req = Request::post(uri)
- .header(header::CONTENT_TYPE, "application/json")
- .body(Buffer::from(Bytes::from(body)))
- .map_err(new_request_build_error)?;
- self.sign(&mut req)?;
-
- let resp = self.info.http_client().send(req).await?;
- if resp.status() != StatusCode::OK {
- return Err(parse_error(resp));
- }
-
- // Update SessionData cookies.We need obtain `X-APPLE-WEBAUTH-USER` cookie to get file.
- self.update(&resp)?;
-
- let bs = resp.into_body();
- let auth_info: IcloudWebservicesResponse =
- serde_json::from_reader(bs.reader()).map_err(new_json_deserialize_error)?;
-
- // Check if we have extra challenge to take.
- if auth_info.hsa_challenge_required && !auth_info.hsa_trusted_browser {
- return Err(Error::new(ErrorKind::Unexpected, "Apple icloud AuthenticationFailed:Unauthorized request:Needs two-factor authentication"));
- }
-
- if let Some(v) = &auth_info.webservices.drivews.url {
- self.data.drivews_url = v.to_string();
- }
- if let Some(v) = &auth_info.webservices.docws.url {
- self.data.docws_url = v.to_string();
- }
-
- self.initiated = true;
- Ok(())
- }
-
- fn sign<T>(&mut self, req: &mut Request<T>) -> Result<()> {
- let headers = req.headers_mut();
-
- headers.insert(
- OAUTH_STATE_HEADER,
- build_header_value(&self.data.oauth_state)?,
- );
-
- if let Some(session_id) = &self.data.session_id {
- headers.insert(SESSION_ID_HEADER, build_header_value(session_id)?);
- }
- if let Some(scnt) = &self.data.scnt {
- headers.insert(SCNT_HEADER, build_header_value(scnt)?);
- }
-
- // You can get more information from [apple.com](https://support.apple.com/en-us/111754)
- if self.is_china_mainland {
- headers.insert(
- header::ORIGIN,
- build_header_value("https://www.icloud.com.cn")?,
- );
- headers.insert(
- header::REFERER,
- build_header_value("https://www.icloud.com.cn/")?,
- );
- } else {
- headers.insert(
- header::ORIGIN,
- build_header_value("https://www.icloud.com")?,
- );
- headers.insert(
- header::REFERER,
- build_header_value("https://www.icloud.com/")?,
- );
- }
-
- if !self.data.cookies.is_empty() {
- let cookies: Vec<String> = self
- .data
- .cookies
- .iter()
- .map(|(k, v)| format!("{}={}", k, v))
- .collect();
- headers.insert(
- header::COOKIE,
- build_header_value(&cookies.as_slice().join("; "))?,
- );
- }
-
- for (key, value) in AUTH_HEADERS {
- headers.insert(key, build_header_value(value)?);
- }
-
- Ok(())
- }
-
- /// Update signer's data after request sent out.
- fn update(&mut self, resp: &Response<Buffer>) -> Result<()> {
- if let Some(account_country) = parse_header_to_str(resp.headers(), ACCOUNT_COUNTRY_HEADER)?
- {
- self.data.account_country = Some(account_country.to_string());
- }
- if let Some(session_id) = parse_header_to_str(resp.headers(), SESSION_ID_HEADER)? {
- self.data.session_id = Some(session_id.to_string());
- }
- if let Some(session_token) = parse_header_to_str(resp.headers(), SESSION_TOKEN_HEADER)? {
- self.data.session_token = Some(session_token.to_string());
- }
-
- if let Some(scnt) = parse_header_to_str(resp.headers(), SCNT_HEADER)? {
- self.data.scnt = Some(scnt.to_string());
- }
-
- let cookies: Vec<String> = resp
- .headers()
- .get_all(header::SET_COOKIE)
- .iter()
- .map(|v| v.to_str().unwrap().to_string())
- .collect();
-
- for cookie in cookies {
- if let Some((key, value)) = cookie.split_once('=') {
- self.data.cookies.insert(key.into(), value.into());
- }
- }
-
- Ok(())
- }
-
- /// Send will make sure the following things:
- ///
- /// - Init the signer if it's not initiated.
- /// - Sign the request.
- /// - Update the session data if needed.
- pub async fn send(&mut self, mut req: Request<Buffer>) -> Result<Response<Buffer>> {
- self.sign(&mut req)?;
- let resp = self.info.http_client().send(req).await?;
-
- Ok(resp)
- }
-}
-
-pub struct IcloudCore {
- pub info: Arc<AccessorInfo>,
- pub signer: Arc<Mutex<IcloudSigner>>,
- pub root: String,
- pub path_cache: PathCacher<IcloudPathQuery>,
-}
-
-impl Debug for IcloudCore {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- let mut de = f.debug_struct("IcloudCore");
- de.field("root", &self.root);
- de.finish()
- }
-}
-
-impl IcloudCore {
- // Retrieves a root within the icloud Drive.
- // "FOLDER::com.apple.CloudDocs::root"
- pub async fn get_root(&self, id: &str) -> Result<IcloudRoot> {
- let mut signer = self.signer.lock().await;
-
- let uri = format!(
- "{}/retrieveItemDetailsInFolders",
- signer.drivews_url().await?
- );
-
- let body = serde_json::to_vec(&json!([
- {
- "drivewsid": id,
- "partialData": false
- }
- ]))
- .map_err(new_json_serialize_error)?;
-
- let req = Request::post(uri)
- .body(Buffer::from(Bytes::from(body)))
- .map_err(new_request_build_error)?;
-
- let resp = signer.send(req).await?;
- if resp.status() != StatusCode::OK {
- return Err(parse_error(resp));
- }
-
- let body = resp.into_body();
- let drive_node: Vec<IcloudRoot> =
- serde_json::from_slice(body.chunk()).map_err(new_json_deserialize_error)?;
- Ok(drive_node[0].clone())
- }
-
- pub async fn get_file(
- &self,
- id: &str,
- zone: &str,
- range: BytesRange,
- args: OpRead,
- ) -> Result<Response<HttpBody>> {
- let mut signer = self.signer.lock().await;
-
- let uri = format!(
- "{}/ws/{}/download/by_id?document_id={}",
- signer.docws_url().await?,
- zone,
- id
- );
-
- let req = Request::get(uri)
- .body(Buffer::new())
- .map_err(new_request_build_error)?;
-
- let resp = signer.send(req).await?;
- if resp.status() != StatusCode::OK {
- return Err(parse_error(resp));
- }
-
- let body = resp.into_body();
- let object: IcloudObject =
- serde_json::from_slice(body.chunk()).map_err(new_json_deserialize_error)?;
-
- let url = object.data_token.url.to_string();
-
- let mut req = Request::get(url);
-
- if let Some(if_match) = args.if_match() {
- req = req.header(IF_MATCH, if_match);
- }
-
- if range.is_full() {
- req = req.header(header::RANGE, range.to_header())
- }
- if let Some(if_none_match) = args.if_none_match() {
- req = req.header(IF_NONE_MATCH, if_none_match);
- }
-
- let req = req.body(Buffer::new()).map_err(new_request_build_error)?;
-
- let resp = self.info.http_client().fetch(req).await?;
-
- Ok(resp)
- }
-
- pub async fn read(
- &self,
- path: &str,
- range: BytesRange,
- args: &OpRead,
- ) -> Result<Response<HttpBody>> {
- let path = build_rooted_abs_path(&self.root, path);
- let base = get_basename(&path);
-
- let path_id = self.path_cache.get(base).await?.ok_or(Error::new(
- ErrorKind::NotFound,
- format!("read path not found: {}", base),
- ))?;
-
- if let Some(docwsid) = path_id.strip_prefix("FILE::com.apple.CloudDocs::") {
- Ok(self
- .get_file(docwsid, "com.apple.CloudDocs", range, args.clone())
- .await?)
- } else {
- Err(Error::new(
- ErrorKind::NotFound,
- "icloud DriveService read error",
- ))
- }
- }
-
- pub async fn stat(&self, path: &str) -> Result<IcloudItem> {
- let path = build_rooted_abs_path(&self.root, path);
-
- let mut base = get_basename(&path);
- let parent = get_parent(&path);
-
- if base.ends_with('/') {
- base = base.trim_end_matches('/');
- }
-
- let file_id = self.path_cache.get(base).await?.ok_or(Error::new(
- ErrorKind::NotFound,
- format!("stat path not found: {}", base),
- ))?;
-
- let folder_id = self.path_cache.get(parent).await?.ok_or(Error::new(
- ErrorKind::NotFound,
- format!("stat path not found: {}", parent),
- ))?;
-
- let node = self.get_root(&folder_id).await?;
-
- match node.items.iter().find(|it| it.drivewsid == file_id.clone()) {
- Some(it) => Ok(it.clone()),
- None => Err(Error::new(
- ErrorKind::NotFound,
- "icloud DriveService stat get parent items error",
- )),
- }
- }
-}
-
-pub struct IcloudPathQuery {
- pub signer: Arc<Mutex<IcloudSigner>>,
-}
-
-impl IcloudPathQuery {
- pub fn new(signer: Arc<Mutex<IcloudSigner>>) -> Self {
- IcloudPathQuery { signer }
- }
-}
-
-impl PathQuery for IcloudPathQuery {
- async fn root(&self) -> Result<String> {
- Ok("FOLDER::com.apple.CloudDocs::root".to_string())
- }
-
- /// Retrieves the root directory within the icloud Drive.
- ///
- /// FIXME: we are reading the entire dir to find the file, this is not efficient.
- /// Maybe we should build a new path cache for this kind of services instead.
- async fn query(&self, parent_id: &str, name: &str) -> Result<Option<String>> {
- let mut signer = self.signer.lock().await;
-
- let uri = format!(
- "{}/retrieveItemDetailsInFolders",
- signer.drivews_url().await?
- );
-
- let body = serde_json::to_vec(&json!([
- {
- "drivewsid": parent_id,
- "partialData": false
- }
- ]))
- .map_err(new_json_serialize_error)?;
-
- let req = Request::post(uri)
- .body(Buffer::from(Bytes::from(body)))
- .map_err(new_request_build_error)?;
-
- let resp = signer.send(req).await?;
- if resp.status() != StatusCode::OK {
- return Err(parse_error(resp));
- }
-
- let body = resp.into_body();
- let root: Vec<IcloudRoot> =
- serde_json::from_slice(body.chunk()).map_err(new_json_deserialize_error)?;
-
- let node = &root[0];
-
- Ok(node
- .items
- .iter()
- .find(|it| it.name == name)
- .map(|it| it.drivewsid.clone()))
- }
-
- async fn create_dir(&self, parent_id: &str, name: &str) -> Result<String> {
- let mut signer = self.signer.lock().await;
-
- let client_id = signer.client_id().to_string();
-
- let uri = format!("{}/createFolders", signer.drivews_url().await?);
- let body = serde_json::to_vec(&json!(
- {
- "destinationDrivewsId": parent_id,
- "folders": [
- {
- "clientId": client_id,
- "name": name,
- }
- ],
- }
- ))
- .map_err(new_json_serialize_error)?;
-
- let req = Request::post(uri)
- .body(Buffer::from(Bytes::from(body)))
- .map_err(new_request_build_error)?;
-
- let resp = signer.send(req).await?;
- if resp.status() != StatusCode::OK {
- return Err(parse_error(resp));
- }
-
- let body = resp.into_body();
- let create_folder: IcloudCreateFolder =
- serde_json::from_slice(body.chunk()).map_err(new_json_deserialize_error)?;
- Ok(create_folder.destination_drivews_id)
- }
-}
-
-pub(super) fn parse_error(resp: Response<Buffer>) -> Error {
- let (parts, body) = resp.into_parts();
- let bs = body.to_bytes();
-
- let mut kind = match parts.status.as_u16() {
- 421 | 450 | 500 => ErrorKind::NotFound,
- 401 => ErrorKind::Unexpected,
- _ => ErrorKind::Unexpected,
- };
-
- let (message, icloud_err) = serde_json::from_reader::<_, IcloudError>(bs.clone().reader())
- .map(|icloud_err| (format!("{icloud_err:?}"), Some(icloud_err)))
- .unwrap_or_else(|_| (String::from_utf8_lossy(&bs).into_owned(), None));
-
- if let Some(icloud_err) = &icloud_err {
- kind = match icloud_err.status_code.as_str() {
- "NOT_FOUND" => ErrorKind::NotFound,
- "PERMISSION_DENIED" => ErrorKind::PermissionDenied,
- _ => ErrorKind::Unexpected,
- }
- }
-
- let mut err = Error::new(kind, message);
-
- err = with_error_response_context(err, parts);
-
- err
-}
-
-#[derive(Default, Debug, Deserialize)]
-#[allow(dead_code)]
-struct IcloudError {
- status_code: String,
- message: String,
-}
-
-#[derive(Default, Deserialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct IcloudWebservicesResponse {
- #[serde(default)]
- pub hsa_challenge_required: bool,
- #[serde(default)]
- pub hsa_trusted_browser: bool,
- pub webservices: Webservices,
-}
-
-#[derive(Deserialize, Default, Clone, Debug)]
-pub struct Webservices {
- pub drivews: Drivews,
- pub docws: Docws,
-}
-
-#[derive(Deserialize, Default, Clone, Debug)]
-#[serde(rename_all = "camelCase")]
-pub struct Drivews {
- pub url: Option<String>,
-}
-
-#[derive(Deserialize, Default, Clone, Debug)]
-#[serde(rename_all = "camelCase")]
-pub struct Docws {
- pub url: Option<String>,
-}
-
-#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct IcloudRoot {
- #[serde(default)]
- pub asset_quota: i64,
- #[serde(default)]
- pub date_created: String,
- #[serde(default)]
- pub direct_children_count: i64,
- pub docwsid: String,
- pub drivewsid: String,
- pub etag: String,
- #[serde(default)]
- pub file_count: i64,
- pub items: Vec<IcloudItem>,
- pub name: String,
- pub number_of_items: i64,
- pub status: String,
- #[serde(rename = "type")]
- pub type_field: String,
- pub zone: String,
-}
-
-#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct IcloudItem {
- #[serde(default)]
- pub asset_quota: Option<i64>,
- #[serde(default)]
- pub date_created: String,
- #[serde(default)]
- pub date_modified: String,
- #[serde(default)]
- pub direct_children_count: Option<i64>,
- pub docwsid: String,
- pub drivewsid: String,
- pub etag: String,
- #[serde(default)]
- pub file_count: Option<i64>,
- pub item_id: Option<String>,
- pub name: String,
- pub parent_id: String,
- #[serde(default)]
- pub size: u64,
- #[serde(rename = "type")]
- pub type_field: String,
- pub zone: String,
- #[serde(default)]
- pub max_depth: Option<String>,
- #[serde(default)]
- pub is_chained_to_parent: Option<bool>,
-}
-
-#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
-pub struct IcloudObject {
- pub document_id: String,
- pub item_id: String,
- pub owner_dsid: i64,
- pub data_token: DataToken,
- pub double_etag: String,
-}
-
-#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
-pub struct DataToken {
- pub url: String,
- pub token: String,
- pub signature: String,
- pub wrapping_key: String,
- pub reference_signature: String,
-}
-
-#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
-pub struct IcloudCreateFolder {
- pub destination_drivews_id: String,
- pub folders: Vec<IcloudItem>,
-}
-
-#[cfg(test)]
-mod tests {
- use pretty_assertions::assert_eq;
-
- use super::IcloudRoot;
- use super::IcloudWebservicesResponse;
-
- #[test]
- fn test_parse_icloud_drive_root_json() {
- let data = r#"{
- "assetQuota": 19603579,
- "dateCreated": "2019-06-10T14:17:49Z",
- "directChildrenCount": 3,
- "docwsid": "root",
- "drivewsid": "FOLDER::com.apple.CloudDocs::root",
- "etag": "w7",
- "fileCount": 22,
- "items": [
- {
- "assetQuota": 19603579,
- "dateCreated": "2021-02-05T08:30:58Z",
- "directChildrenCount": 22,
- "docwsid": "1E013608-C669-43DB-AC14-3D7A4E0A0500",
- "drivewsid": "FOLDER::com.apple.CloudDocs::1E013608-C669-43DB-AC14-3D7A4E0A0500",
- "etag": "sn",
- "fileCount": 22,
- "item_id": "CJWdk48eEAAiEB4BNgjGaUPbrBQ9ek4KBQAoAQ",
- "name": "Downloads",
- "parentId": "FOLDER::com.apple.CloudDocs::root",
- "shareAliasCount": 0,
- "shareCount": 0,
- "type": "FOLDER",
- "zone": "com.apple.CloudDocs"
- },
- {
- "dateCreated": "2019-06-10T14:17:54Z",
- "docwsid": "documents",
- "drivewsid": "FOLDER::com.apple.Keynote::documents",
- "etag": "1v",
- "maxDepth": "ANY",
- "name": "Keynote",
- "parentId": "FOLDER::com.apple.CloudDocs::root",
- "type": "APP_LIBRARY",
- "zone": "com.apple.Keynote"
- },
- {
- "assetQuota": 0,
- "dateCreated": "2024-01-06T02:35:08Z",
- "directChildrenCount": 0,
- "docwsid": "21E4A15E-DA77-472A-BAC8-B0C35A91F237",
- "drivewsid": "FOLDER::com.apple.CloudDocs::21E4A15E-DA77-472A-BAC8-B0C35A91F237",
- "etag": "w8",
- "fileCount": 0,
- "isChainedToParent": true,
- "item_id": "CJWdk48eEAAiECHkoV7ad0cqusiww1qR8jcoAQ",
- "name": "opendal",
- "parentId": "FOLDER::com.apple.CloudDocs::root",
- "shareAliasCount": 0,
- "shareCount": 0,
- "type": "FOLDER",
- "zone": "com.apple.CloudDocs"
- }
- ],
- "name": "",
- "numberOfItems": 16,
- "shareAliasCount": 0,
- "shareCount": 0,
- "status": "OK",
- "type": "FOLDER",
- "zone": "com.apple.CloudDocs"
- }"#;
-
- let response: IcloudRoot = serde_json::from_str(data).unwrap();
- assert_eq!(response.name, "");
- assert_eq!(response.type_field, "FOLDER");
- assert_eq!(response.zone, "com.apple.CloudDocs");
- assert_eq!(response.docwsid, "root");
- assert_eq!(response.drivewsid, "FOLDER::com.apple.CloudDocs::root");
- assert_eq!(response.etag, "w7");
- assert_eq!(response.file_count, 22);
- }
-
- #[test]
- fn test_parse_icloud_drive_folder_file() {
- let data = r#"{
- "assetQuota": 19603579,
- "dateCreated": "2021-02-05T08:34:21Z",
- "directChildrenCount": 22,
- "docwsid": "1E013608-C669-43DB-AC14-3D7A4E0A0500",
- "drivewsid": "FOLDER::com.apple.CloudDocs::1E013608-C669-43DB-AC14-3D7A4E0A0500",
- "etag": "w9",
- "fileCount": 22,
- "items": [
- {
- "dateChanged": "2021-02-18T14:10:46Z",
- "dateCreated": "2021-02-10T07:01:34Z",
- "dateModified": "2021-02-10T07:01:34Z",
- "docwsid": "9605331E-7BF3-41A0-A128-A68FFA377C50",
- "drivewsid": "FILE::com.apple.CloudDocs::9605331E-7BF3-41A0-A128-A68FFA377C50",
- "etag": "5b::5a",
- "extension": "pdf",
- "item_id": "CJWdk48eEAAiEJYFMx5780GgoSimj_o3fFA",
- "lastOpenTime": "2021-02-10T10:28:42Z",
- "name": "1-11-ARP-notes",
- "parentId": "FOLDER::com.apple.CloudDocs::1E013608-C669-43DB-AC14-3D7A4E0A0500",
- "size": 639483,
- "type": "FILE",
- "zone": "com.apple.CloudDocs"
- }
- ],
- "name": "Downloads",
- "numberOfItems": 22,
- "parentId": "FOLDER::com.apple.CloudDocs::root",
- "shareAliasCount": 0,
- "shareCount": 0,
- "status": "OK",
- "type": "FOLDER",
- "zone": "com.apple.CloudDocs"
- }"#;
-
- let response = serde_json::from_str::<IcloudRoot>(data).unwrap();
-
- assert_eq!(response.name, "Downloads");
- assert_eq!(response.type_field, "FOLDER");
- assert_eq!(response.zone, "com.apple.CloudDocs");
- assert_eq!(response.docwsid, "1E013608-C669-43DB-AC14-3D7A4E0A0500");
- assert_eq!(
- response.drivewsid,
- "FOLDER::com.apple.CloudDocs::1E013608-C669-43DB-AC14-3D7A4E0A0500"
- );
- assert_eq!(response.etag, "w9");
- assert_eq!(response.file_count, 22);
- }
-
- #[test]
- fn test_parse_icloud_webservices() {
- let data = r#"
- {
- "hsaChallengeRequired": false,
- "hsaTrustedBrowser": true,
- "webservices": {
- "docws": {
- "pcsRequired": true,
- "status": "active",
- "url": "https://p219-docws.icloud.com.cn:443"
- },
- "drivews": {
- "pcsRequired": true,
- "status": "active",
- "url": "https://p219-drivews.icloud.com.cn:443"
- }
- }
- }
- "#;
- let response = serde_json::from_str::<IcloudWebservicesResponse>(data).unwrap();
- assert!(!response.hsa_challenge_required);
- assert!(response.hsa_trusted_browser);
- assert_eq!(
- response.webservices.docws.url,
- Some("https://p219-docws.icloud.com.cn:443".to_string())
- );
- assert_eq!(
- response.webservices.drivews.url,
- Some("https://p219-drivews.icloud.com.cn:443".to_string())
- );
- }
-}
diff --git a/core/src/services/icloud/docs.md b/core/src/services/icloud/docs.md
deleted file mode 100644
index 741a9c3c9..000000000
--- a/core/src/services/icloud/docs.md
+++ /dev/null
@@ -1,65 +0,0 @@
-## Capabilities
-
-This service can be used to:
-
-- [x] stat
-- [x] read
-- [ ] write
-- [ ] delete
-- [ ] create_dir
-- [ ] list
-- [ ] copy
-- [ ] rename
-- [ ] batch
-
-
-# Configuration
-
-- `root`: Set the work directory for backend
-
-### Credentials related
-
-#### provide Session (Temporary)
-
-- `trust_token`: set the trust_token for icloud drive api
- Please notice its expiration.
-- `ds_web_auth_token`: set the ds_web_auth_token for icloud drive api
- Get web trust the session.
-- `is_china_mainland`: set the is_china_mainland for icloud drive api
- China region must true to use <https://www.icloud.com.cn>
- Otherwise Apple server will return 302.
- More information you can get [apple.com](https://support.apple.com/en-us/111754)
-
-OpenDAL is a library, it cannot do the first step of OAuth2 for you.
-You need to get authorization code from user by calling icloudDrive's authorize url
-and save it for session's trust_token and session_token(ds_web_auth_token).
-
-Make sure you have enabled Apple icloud Drive API in your Apple icloud ID.
-And your OAuth scope contains valid `Session`.
-
-You can get more information from [pyicloud](https://github.com/picklepete/pyicloud/tree/master?tab=readme-ov-file#authentication) or
-[iCloud-API](https://github.com/MauriceConrad/iCloud-API?tab=readme-ov-file#getting-started)
-
-You can refer to [`IcloudBuilder`]'s docs for more information
-
-## Example
-
-### Via Builder
-
-```rust,no_run
-use anyhow::Result;
-use opendal::services::Icloud;
-use opendal::Operator;
-
-#[tokio::main]
-async fn main() -> Result<()> {
- let mut builder = Icloud::default()
- .root("/")
- .apple_id("<apple_id>")
- .password("<password>")
- .trust_token("<trust_token>")
- .ds_web_auth_token("<ds_web_auth_token>")
- .is_china_mainland(true);
-
- Ok(())
-}
diff --git a/core/src/services/icloud/mod.rs b/core/src/services/icloud/mod.rs
deleted file mode 100644
index 92111fee0..000000000
--- a/core/src/services/icloud/mod.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#[cfg(feature = "services-icloud")]
-mod core;
-
-#[cfg(feature = "services-icloud")]
-mod backend;
-#[cfg(feature = "services-icloud")]
-pub use backend::IcloudBuilder as Icloud;
-
-mod config;
-pub use config::IcloudConfig;
diff --git a/core/src/services/mod.rs b/core/src/services/mod.rs
index 35f78e35f..a78fd9a17 100644
--- a/core/src/services/mod.rs
+++ b/core/src/services/mod.rs
@@ -25,9 +25,6 @@ pub use aliyun_drive::*;
mod alluxio;
pub use alluxio::*;
-mod atomicserver;
-pub use self::atomicserver::*;
-
mod azblob;
pub use azblob::*;
@@ -103,9 +100,6 @@ pub use self::http::*;
mod huggingface;
pub use huggingface::*;
-mod icloud;
-pub use icloud::*;
-
mod ipfs;
pub use self::ipfs::*;
@@ -139,9 +133,6 @@ pub use monoiofs::*;
mod mysql;
pub use self::mysql::*;
-mod nebula_graph;
-pub use nebula_graph::*;
-
mod obs;
pub use obs::*;
diff --git a/core/src/services/nebula_graph/backend.rs b/core/src/services/nebula_graph/backend.rs
deleted file mode 100644
index ce7893628..000000000
--- a/core/src/services/nebula_graph/backend.rs
+++ /dev/null
@@ -1,401 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-use std::fmt::Debug;
-#[cfg(feature = "tests")]
-use std::time::Duration;
-use std::vec;
-
-use base64::engine::general_purpose::STANDARD as BASE64;
-use base64::engine::Engine as _;
-use bb8::PooledConnection;
-use bb8::RunError;
-use rust_nebula::graph::GraphQuery;
-use rust_nebula::HostAddress;
-use rust_nebula::SingleConnSessionConf;
-use rust_nebula::SingleConnSessionManager;
-use snowflaked::sync::Generator;
-use tokio::sync::OnceCell;
-
-use crate::raw::adapters::kv;
-use crate::raw::*;
-use crate::services::NebulaGraphConfig;
-use crate::*;
-
-static GENERATOR: Generator = Generator::new(0);
-
-impl Configurator for NebulaGraphConfig {
- type Builder = NebulaGraphBuilder;
- fn into_builder(self) -> Self::Builder {
- NebulaGraphBuilder { config: self }
- }
-}
-
-#[doc = include_str!("docs.md")]
-#[derive(Default)]
-pub struct NebulaGraphBuilder {
- config: NebulaGraphConfig,
-}
-
-impl Debug for NebulaGraphBuilder {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- let mut d = f.debug_struct("MysqlBuilder");
-
- d.field("config", &self.config).finish()
- }
-}
-
-impl NebulaGraphBuilder {
- /// Set the host addr of nebulagraph's graphd server
- pub fn host(&mut self, host: &str) -> &mut Self {
- if !host.is_empty() {
- self.config.host = Some(host.to_string());
- }
- self
- }
-
- /// Set the host port of nebulagraph's graphd server
- pub fn port(&mut self, port: u16) -> &mut Self {
- self.config.port = Some(port);
- self
- }
-
- /// Set the username of nebulagraph's graphd server
- pub fn username(&mut self, username: &str) -> &mut Self {
- if !username.is_empty() {
- self.config.username = Some(username.to_string());
- }
- self
- }
-
- /// Set the password of nebulagraph's graphd server
- pub fn password(&mut self, password: &str) -> &mut Self {
- if !password.is_empty() {
- self.config.password = Some(password.to_string());
- }
- self
- }
-
- /// Set the space name of nebulagraph's graphd server
- pub fn space(&mut self, space: &str) -> &mut Self {
- if !space.is_empty() {
- self.config.space = Some(space.to_string());
- }
- self
- }
-
- /// Set the tag name of nebulagraph's graphd server
- pub fn tag(&mut self, tag: &str) -> &mut Self {
- if !tag.is_empty() {
- self.config.tag = Some(tag.to_string());
- }
- self
- }
-
- /// Set the key field name of the NebulaGraph service to read/write.
- ///
- /// Default to `key` if not specified.
- pub fn key_field(&mut self, key_field: &str) -> &mut Self {
- if !key_field.is_empty() {
- self.config.key_field = Some(key_field.to_string());
- }
- self
- }
-
- /// Set the value field name of the NebulaGraph service to read/write.
- ///
- /// Default to `value` if not specified.
- pub fn value_field(&mut self, value_field: &str) -> &mut Self {
- if !value_field.is_empty() {
- self.config.value_field = Some(value_field.to_string());
- }
- self
- }
-
- /// set the working directory, all operations will be performed under it.
- ///
- /// default: "/"
- pub fn root(&mut self, root: &str) -> &mut Self {
- if !root.is_empty() {
- self.config.root = Some(root.to_string());
- }
- self
- }
-}
-
-impl Builder for NebulaGraphBuilder {
- const SCHEME: Scheme = Scheme::NebulaGraph;
- type Config = NebulaGraphConfig;
-
- fn build(self) -> Result<impl Access> {
- let host = match self.config.host.clone() {
- Some(v) => v,
- None => {
- return Err(Error::new(ErrorKind::ConfigInvalid, "host is empty")
- .with_context("service", Scheme::NebulaGraph))
- }
- };
- let port = match self.config.port {
- Some(v) => v,
- None => {
- return Err(Error::new(ErrorKind::ConfigInvalid, "port is empty")
- .with_context("service", Scheme::NebulaGraph))
- }
- };
- let username = match self.config.username.clone() {
- Some(v) => v,
- None => {
- return Err(Error::new(ErrorKind::ConfigInvalid, "username is empty")
- .with_context("service", Scheme::NebulaGraph))
- }
- };
- let password = match self.config.password.clone() {
- Some(v) => v,
- None => "".to_string(),
- };
- let space = match self.config.space.clone() {
- Some(v) => v,
- None => {
- return Err(Error::new(ErrorKind::ConfigInvalid, "space is empty")
- .with_context("service", Scheme::NebulaGraph))
- }
- };
- let tag = match self.config.tag.clone() {
- Some(v) => v,
- None => {
- return Err(Error::new(ErrorKind::ConfigInvalid, "tag is empty")
- .with_context("service", Scheme::NebulaGraph))
- }
- };
- let key_field = match self.config.key_field.clone() {
- Some(v) => v,
- None => "key".to_string(),
- };
- let value_field = match self.config.value_field.clone() {
- Some(v) => v,
- None => "value".to_string(),
- };
- let root = normalize_root(
- self.config
- .root
- .clone()
- .unwrap_or_else(|| "/".to_string())
- .as_str(),
- );
-
- let mut session_config = SingleConnSessionConf::new(
- vec![HostAddress::new(&host, port)],
- username,
- password,
- Some(space),
- );
- // NebulaGraph use fbthrift for communication. fbthrift's max_buffer_size is default 4 KB,
- // which is too small to store something.
- // So we could set max_buffer_size to 10 MB so that NebulaGraph can store files with filesize < 1 MB at least.
- session_config.set_buf_size(1024 * 1024);
- session_config.set_max_buf_size(64 * 1024 * 1024);
- session_config.set_max_parse_response_bytes_count(254);
-
- Ok(NebulaGraphBackend::new(Adapter {
- session_pool: OnceCell::new(),
- session_config,
-
- tag,
- key_field,
- value_field,
- })
- .with_root(root.as_str()))
- }
-}
-
-/// Backend for NebulaGraph service
-pub type NebulaGraphBackend = kv::Backend<Adapter>;
-
-#[derive(Clone)]
-pub struct Adapter {
- session_pool: OnceCell<bb8::Pool<SingleConnSessionManager>>,
- session_config: SingleConnSessionConf,
-
- tag: String,
- key_field: String,
- value_field: String,
-}
-
-impl Debug for Adapter {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- f.debug_struct("Adapter")
- .field("session_config", &self.session_config)
- .field("tag", &self.tag)
- .field("key_field", &self.key_field)
- .field("value_field", &self.value_field)
- .finish()
- }
-}
-
-impl Adapter {
- async fn get_session(&self) -> Result<PooledConnection<SingleConnSessionManager>> {
- let session_pool = self
- .session_pool
- .get_or_try_init(|| async {
- bb8::Pool::builder()
- .max_size(64)
- .build(SingleConnSessionManager::new(self.session_config.clone()))
- .await
- })
- .await
- .map_err(|err| Error::new(ErrorKind::Unexpected, format!("{}", err)).set_temporary())?;
-
- session_pool.get().await.map_err(|err| match err {
- RunError::User(err) => {
- Error::new(ErrorKind::Unexpected, format!("{}", err)).set_temporary()
- }
- RunError::TimedOut => {
- Error::new(ErrorKind::Unexpected, "connection request: timeout").set_temporary()
- }
- })
- }
-}
-
-impl kv::Adapter for Adapter {
- type Scanner = kv::ScanStdIter<vec::IntoIter<Result<String>>>;
-
- fn info(&self) -> kv::Info {
- kv::Info::new(
- Scheme::NebulaGraph,
- &self.session_config.space.clone().unwrap(),
- Capability {
- read: true,
- write: true,
- write_total_max_size: Some(1024 * 1024),
- write_can_empty: true,
- delete: true,
- list: true,
- shared: true,
- ..Default::default()
- },
- )
- }
-
- async fn get(&self, path: &str) -> Result<Option<Buffer>> {
- let path = path.replace("'", "\\'").replace('"', "\\\"");
- let query = format!(
- "LOOKUP ON {} WHERE {}.{} == '{}' YIELD properties(vertex).{} AS {};",
- self.tag, self.tag, self.key_field, path, self.value_field, self.value_field
- );
- let mut sess = self.get_session().await?;
- let result = sess
- .query(&query)
- .await
- .map_err(parse_nebulagraph_session_error)?;
- if result.is_empty() {
- Ok(None)
- } else {
- let row = result
- .get_row_values_by_index(0)
- .map_err(parse_nebulagraph_dataset_error)?;
- let value = row
- .get_value_by_col_name(&self.value_field)
- .map_err(parse_nebulagraph_dataset_error)?;
- let base64_str = value.as_string().map_err(parse_nebulagraph_dataset_error)?;
- let value_str = BASE64.decode(base64_str).map_err(|err| {
- Error::new(ErrorKind::Unexpected, "unhandled error from nebulagraph")
- .set_source(err)
- })?;
- let buf = Buffer::from(value_str);
- Ok(Some(buf))
- }
- }
-
- async fn set(&self, path: &str, value: Buffer) -> Result<()> {
- #[cfg(feature = "tests")]
- let path_copy = path;
-
- self.delete(path).await?;
- let path = path.replace("'", "\\'").replace('"', "\\\"");
- let file = value.to_vec();
- let file = BASE64.encode(&file);
- let snowflake_id: u64 = GENERATOR.generate();
- let query = format!(
- "INSERT VERTEX {} VALUES {}:('{}', '{}');",
- self.tag, snowflake_id, path, file
- );
- let mut sess = self.get_session().await?;
- sess.execute(&query)
- .await
- .map_err(parse_nebulagraph_session_error)?;
-
- // To pass tests, we should confirm NebulaGraph has inserted data successfully
- #[cfg(feature = "tests")]
- loop {
- let v = self.get(path_copy).await.unwrap();
- if v.is_none() {
- std::thread::sleep(Duration::from_millis(1000));
- } else {
- break;
- }
- }
- Ok(())
- }
-
- async fn delete(&self, path: &str) -> Result<()> {
- let path = path.replace("'", "\\'").replace('"', "\\\"");
- let query = format!(
- "LOOKUP ON {} WHERE {}.{} == '{}' YIELD id(vertex) AS id | DELETE VERTEX $-.id;",
- self.tag, self.tag, self.key_field, path
- );
- let mut sess = self.get_session().await?;
- sess.execute(&query)
- .await
- .map_err(parse_nebulagraph_session_error)?;
- Ok(())
- }
-
- async fn scan(&self, path: &str) -> Result<Self::Scanner> {
- let path = path.replace("'", "\\'").replace('"', "\\\"");
- let query = format!(
- "LOOKUP ON {} WHERE {}.{} STARTS WITH '{}' YIELD properties(vertex).{} AS {};",
- self.tag, self.tag, self.key_field, path, self.key_field, self.key_field
- );
-
- let mut sess = self.get_session().await?;
- let result = sess
- .query(&query)
- .await
- .map_err(parse_nebulagraph_session_error)?;
- let mut res_vec = vec![];
- for row_i in 0..result.get_row_size() {
- let row = result
- .get_row_values_by_index(row_i)
- .map_err(parse_nebulagraph_dataset_error)?;
- let value = row
- .get_value_by_col_name(&self.key_field)
- .map_err(parse_nebulagraph_dataset_error)?;
- let sub_path = value.as_string().map_err(parse_nebulagraph_dataset_error)?;
-
- res_vec.push(Ok(sub_path));
- }
- Ok(kv::ScanStdIter::new(res_vec.into_iter()))
- }
-}
-
-fn parse_nebulagraph_session_error(err: rust_nebula::SingleConnSessionError) -> Error {
- Error::new(ErrorKind::Unexpected, "unhandled error from nebulagraph").set_source(err)
-}
-
-fn parse_nebulagraph_dataset_error(err: rust_nebula::DataSetError) -> Error {
- Error::new(ErrorKind::Unexpected, "unhandled error from nebulagraph").set_source(err)
-}
diff --git a/core/src/services/nebula_graph/config.rs b/core/src/services/nebula_graph/config.rs
deleted file mode 100644
index 6c3da6c7c..000000000
--- a/core/src/services/nebula_graph/config.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-use std::fmt::Debug;
-
-use serde::Deserialize;
-use serde::Serialize;
-
-/// Config for Mysql services support.
-#[derive(Default, Serialize, Deserialize, Clone, PartialEq, Eq)]
-#[serde(default)]
-#[non_exhaustive]
-pub struct NebulaGraphConfig {
- /// The host addr of nebulagraph's graphd server
- pub host: Option<String>,
- /// The host port of nebulagraph's graphd server
- pub port: Option<u16>,
- /// The username of nebulagraph's graphd server
- pub username: Option<String>,
- /// The password of nebulagraph's graphd server
- pub password: Option<String>,
-
- /// The space name of nebulagraph's graphd server
- pub space: Option<String>,
- /// The tag name of nebulagraph's graphd server
- pub tag: Option<String>,
- /// The key field name of the NebulaGraph service to read/write.
- pub key_field: Option<String>,
- /// The value field name of the NebulaGraph service to read/write.
- pub value_field: Option<String>,
- /// The root for NebulaGraph
- pub root: Option<String>,
-}
-
-impl Debug for NebulaGraphConfig {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- let mut d = f.debug_struct("NebulaGraphConfig");
-
- d.field("host", &self.host)
- .field("port", &self.port)
- .field("username", &self.username)
- .field("password", &self.password)
- .field("space", &self.space)
- .field("tag", &self.tag)
- .field("key_field", &self.key_field)
- .field("value_field", &self.value_field)
- .field("root", &self.root)
- .finish()
- }
-}
diff --git a/core/src/services/nebula_graph/docs.md b/core/src/services/nebula_graph/docs.md
deleted file mode 100644
index bd219e717..000000000
--- a/core/src/services/nebula_graph/docs.md
+++ /dev/null
@@ -1,53 +0,0 @@
-## Capabilities
-
-This service can be used to:
-
-- [x] stat
-- [x] read
-- [x] write
-- [x] create_dir
-- [x] delete
-- [ ] copy
-- [ ] rename
-- [x] list
-- [ ] ~~presign~~
-- [ ] blocking
-
-## Configuration
-
-- `root`: Set the working directory of `OpenDAL`
-- `host`: Set the host address of NebulaGraph's graphd server
-- `port`: Set the port of NebulaGraph's graphd server
-- `username`: Set the username of NebulaGraph's graphd server
-- `password`: Set the password of NebulaGraph's graphd server
-- `space`: Set the passspaceword of NebulaGraph
-- `tag`: Set the tag of NebulaGraph
-- `key_field`: Set the key_field of NebulaGraph
-- `value_field`: Set the value_field of NebulaGraph
-
-## Example
-
-### Via Builder
-
-```rust,no_run
-use anyhow::Result;
-use opendal::services::NebulaGraph;
-use opendal::Operator;
-
-#[tokio::main]
-async fn main() -> Result<()> {
- let mut builder = NebulaGraph::default();
- builder.root("/");
- builder.host("127.0.0.1");
- builder.port(9669);
- builder.space("your_space");
- builder.tag("your_tag");
- // key field type in the table should be compatible with Rust's &str like text
- builder.key_field("key");
- // value field type in the table should be compatible with Rust's Vec<u8> like bytea
- builder.value_field("value");
-
- let op = Operator::new(builder)?.finish();
- Ok(())
-}
-```
diff --git a/core/src/services/nebula_graph/mod.rs b/core/src/services/nebula_graph/mod.rs
deleted file mode 100644
index af5429b8c..000000000
--- a/core/src/services/nebula_graph/mod.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#[cfg(feature = "services-nebula-graph")]
-mod backend;
-#[cfg(feature = "services-nebula-graph")]
-pub use backend::NebulaGraphBuilder as NebulaGraph;
-
-mod config;
-pub use config::NebulaGraphConfig;
diff --git a/core/src/types/operator/builder.rs b/core/src/types/operator/builder.rs
index ccd381155..c9c168d64 100644
--- a/core/src/types/operator/builder.rs
+++ b/core/src/types/operator/builder.rs
@@ -168,8 +168,6 @@ impl Operator {
let op = match scheme {
#[cfg(feature = "services-aliyun-drive")]
Scheme::AliyunDrive => Self::from_iter::<services::AliyunDrive>(iter)?.finish(),
- #[cfg(feature = "services-atomicserver")]
- Scheme::Atomicserver => Self::from_iter::<services::Atomicserver>(iter)?.finish(),
#[cfg(feature = "services-alluxio")]
Scheme::Alluxio => Self::from_iter::<services::Alluxio>(iter)?.finish(),
#[cfg(feature = "services-compfs")]
@@ -226,8 +224,6 @@ impl Operator {
Scheme::Ipfs => Self::from_iter::<services::Ipfs>(iter)?.finish(),
#[cfg(feature = "services-ipmfs")]
Scheme::Ipmfs => Self::from_iter::<services::Ipmfs>(iter)?.finish(),
- #[cfg(feature = "services-icloud")]
- Scheme::Icloud => Self::from_iter::<services::Icloud>(iter)?.finish(),
#[cfg(feature = "services-memcached")]
Scheme::Memcached => Self::from_iter::<services::Memcached>(iter)?.finish(),
#[cfg(feature = "services-memory")]
@@ -286,8 +282,6 @@ impl Operator {
Scheme::HdfsNative => Self::from_iter::<services::HdfsNative>(iter)?.finish(),
#[cfg(feature = "services-lakefs")]
Scheme::Lakefs => Self::from_iter::<services::Lakefs>(iter)?.finish(),
- #[cfg(feature = "services-nebula-graph")]
- Scheme::NebulaGraph => Self::from_iter::<services::NebulaGraph>(iter)?.finish(),
v => {
return Err(Error::new(
ErrorKind::Unsupported,
diff --git a/core/src/types/scheme.rs b/core/src/types/scheme.rs
index 20efe9b93..6d9c06b56 100644
--- a/core/src/types/scheme.rs
+++ b/core/src/types/scheme.rs
@@ -195,8 +195,6 @@ impl Scheme {
HashSet::from([
#[cfg(feature = "services-aliyun-drive")]
Scheme::AliyunDrive,
- #[cfg(feature = "services-atomicserver")]
- Scheme::Atomicserver,
#[cfg(feature = "services-alluxio")]
Scheme::Alluxio,
#[cfg(feature = "services-azblob")]
@@ -239,8 +237,6 @@ impl Scheme {
Scheme::Ipfs,
#[cfg(feature = "services-ipmfs")]
Scheme::Ipmfs,
- #[cfg(feature = "services-icloud")]
- Scheme::Icloud,
#[cfg(feature = "services-memcached")]
Scheme::Memcached,
#[cfg(feature = "services-memory")]
@@ -307,8 +303,6 @@ impl Scheme {
Scheme::Surrealdb,
#[cfg(feature = "services-lakefs")]
Scheme::Lakefs,
- #[cfg(feature = "services-nebula-graph")]
- Scheme::NebulaGraph,
])
}
}
@@ -332,7 +326,6 @@ impl FromStr for Scheme {
let s = s.to_lowercase();
match s.as_str() {
"aliyun_drive" => Ok(Scheme::AliyunDrive),
- "atomicserver" => Ok(Scheme::Atomicserver),
"azblob" => Ok(Scheme::Azblob),
"alluxio" => Ok(Scheme::Alluxio),
// Notes:
@@ -362,7 +355,6 @@ impl FromStr for Scheme {
"ftp" | "ftps" => Ok(Scheme::Ftp),
"ipfs" | "ipns" => Ok(Scheme::Ipfs),
"ipmfs" => Ok(Scheme::Ipmfs),
- "icloud" => Ok(Scheme::Icloud),
"koofr" => Ok(Scheme::Koofr),
"memcached" => Ok(Scheme::Memcached),
"memory" => Ok(Scheme::Memory),
@@ -397,7 +389,6 @@ impl FromStr for Scheme {
"hdfs_native" => Ok(Scheme::HdfsNative),
"surrealdb" => Ok(Scheme::Surrealdb),
"lakefs" => Ok(Scheme::Lakefs),
- "nebula_graph" => Ok(Scheme::NebulaGraph),
_ => Ok(Scheme::Custom(Box::leak(s.into_boxed_str()))),
}
}