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 e81760b7a6 feat(services/remotestorage): add read-only remoteStorage
service (#9359)
e81760b7a6 is described below
commit e81760b7a600ea52b3dbf49da853279e906132bf
Author: Jono <[email protected]>
AuthorDate: Sun Nov 29 08:30:16 2026 -0800
feat(services/remotestorage): add read-only remoteStorage service (#9359)
* feat(services/remotestorage): add read-only remoteStorage service
Add a service for remoteStorage (draft-dejong-remotestorage) supporting
stat, read and list. Configuration is the storage root URL, a bearer
token, a root path and an optional Origin for servers that bind tokens
to an application origin.
When a server ignores Range (range support is optional in the
protocol), the reader discards bytes outside the requested range.
Behavior tests run against RSilo and armadietto in CI; empty fixture
directories get a placeholder document because remoteStorage folders
exist only while they contain documents.
* chore(services/remotestorage): symlink LICENSE and NOTICE like other
services
* fix(services/remotestorage): address review feedback
- Fail ranged reads with a permanent Unexpected error when the server
answers 200 instead of 206, dropping the body without draining it,
instead of discarding bytes client-side.
- Mark the lister done only after a page is processed, so RetryLayer
re-sends the folder GET after a temporary error.
- Mark endpoint as required with an HTTPS example, and hide the Go
snippet until its companion module is published.
The armadietto setup sets OPENDAL_TEST_REMOTESTORAGE_IGNORES_RANGE,
which replaces the shared range tests with an assertion of the explicit
error. RSilo keeps the full shared suite.
---
.env.example | 5 +
.github/actions/test_behavior_core/action.yaml | 2 +-
.../services/remotestorage/armadietto/action.yml | 47 +++
.github/services/remotestorage/rsilo/action.yml | 42 +++
README.md | 2 +-
core/Cargo.lock | 17 +
core/Cargo.toml | 2 +
core/services/remotestorage/Cargo.toml | 42 +++
core/services/remotestorage/LICENSE | 1 +
core/services/remotestorage/NOTICE | 1 +
core/services/remotestorage/README.md | 56 ++++
core/services/remotestorage/src/backend.rs | 357 +++++++++++++++++++++
core/services/remotestorage/src/config.rs | 121 +++++++
core/services/remotestorage/src/core.rs | 252 +++++++++++++++
core/services/remotestorage/src/docs.md | 81 +++++
core/services/remotestorage/src/lib.rs | 43 +++
core/services/remotestorage/src/lister.rs | 193 +++++++++++
core/services/remotestorage/src/reader.rs | 98 ++++++
core/src/lib.rs | 5 +
core/tests/behavior/async_read.rs | 39 ++-
dev/src/generate/docs.rs | 3 +-
dev/src/generate/dotnet.rs | 3 +-
dev/src/generate/java.rs | 3 +-
.../remotestorage/docker-compose-armadietto.yml | 67 ++++
fixtures/remotestorage/docker-compose-rsilo.yml | 27 ++
fixtures/remotestorage/mint_armadietto_token.py | 59 ++++
fixtures/remotestorage/seed.sh | 58 ++++
website/data/capabilities.json | 12 +
website/data/services.json | 46 +++
29 files changed, 1676 insertions(+), 8 deletions(-)
diff --git a/.env.example b/.env.example
index ce0e956524..6d027667bd 100644
--- a/.env.example
+++ b/.env.example
@@ -182,6 +182,11 @@ OPENDAL_HUGGINGFACE_REPO_TYPE=dataset
OPENDAL_HUGGINGFACE_REPO_ID=opendal/huggingface-testdata
OPENDAL_HUGGINGFACE_REVISION=main
OPENDAL_HUGGINGFACE_ROOT=/testdata/
+# remotestorage
+OPENDAL_REMOTESTORAGE_ENDPOINT=https://storage.example.com/<user>
+OPENDAL_REMOTESTORAGE_TOKEN=<bearer_token>
+OPENDAL_REMOTESTORAGE_ROOT=/opendal/
+# OPENDAL_REMOTESTORAGE_ORIGIN=https://app.example.com
# seafile
OPENDAL_SEAFILE_ROOT=/path/to/dir
OPENDAL_SEAFILE_ENDPOINT=<endpoint>
diff --git a/.github/actions/test_behavior_core/action.yaml
b/.github/actions/test_behavior_core/action.yaml
index b230844b99..361fa60f20 100644
--- a/.github/actions/test_behavior_core/action.yaml
+++ b/.github/actions/test_behavior_core/action.yaml
@@ -133,7 +133,7 @@ runs:
service_prefix=\$(printf '%s' "$TEST_SERVICE" | tr '[:lower:]-'
'[:upper:]_')
while IFS='=' read -r name _; do
case "\$name" in
- "OPENDAL_\${service_prefix}_"* | OPENDAL_DISABLE_RANDOM_ROOT
| OPENDAL_TEST_CAPABILITY_OVERRIDES | OPENDAL_TEST_IO_TIMEOUT |
OPENDAL_TEST_MINIO_WITHOUT_CRC64NVME)
+ "OPENDAL_\${service_prefix}_"* | OPENDAL_DISABLE_RANDOM_ROOT
| OPENDAL_TEST_CAPABILITY_OVERRIDES | OPENDAL_TEST_IO_TIMEOUT |
OPENDAL_TEST_MINIO_WITHOUT_CRC64NVME | OPENDAL_TEST_REMOTESTORAGE_IGNORES_RANGE)
echo "\$name=__OPENDAL_TEST_UNSET__" >>"\$GITHUB_ENV"
;;
esac
diff --git a/.github/services/remotestorage/armadietto/action.yml
b/.github/services/remotestorage/armadietto/action.yml
new file mode 100644
index 0000000000..bb9e71c9b3
--- /dev/null
+++ b/.github/services/remotestorage/armadietto/action.yml
@@ -0,0 +1,47 @@
+# 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.
+
+name: armadietto
+description: "Behavior test for remoteStorage in armadietto"
+
+runs:
+ using: "composite"
+ steps:
+ - name: Setup armadietto
+ shell: bash
+ working-directory: fixtures/remotestorage
+ run: docker compose -f docker-compose-armadietto.yml up -d --wait
+ - name: Seed read-only fixtures
+ shell: bash
+ working-directory: fixtures/remotestorage
+ run: |
+ # armadietto keeps each account in an S3 bucket named
<user>-<host_identity>.
+ curl -sSf -o /dev/null -X PUT \
+ --aws-sigv4 "aws:amz:us-east-1:s3" --user minioadmin:minioadmin \
+ http://127.0.0.1:9000/opendal-localhost
+ origin=https://app.example.com
+ token=$(./mint_armadietto_token.py opendal-test-jwt-secret localhost
opendal '*:rw' "$origin")
+ echo "::add-mask::$token"
+ ./seed.sh http://127.0.0.1:8000/storage/opendal "$token" /opendal/
"$origin"
+ cat << EOF >> $GITHUB_ENV
+ OPENDAL_REMOTESTORAGE_ENDPOINT=http://127.0.0.1:8000/storage/opendal
+ OPENDAL_REMOTESTORAGE_TOKEN=$token
+ OPENDAL_REMOTESTORAGE_ORIGIN=$origin
+ OPENDAL_REMOTESTORAGE_ROOT=/opendal/
+ OPENDAL_DISABLE_RANDOM_ROOT=true
+ OPENDAL_TEST_REMOTESTORAGE_IGNORES_RANGE=true
+ EOF
diff --git a/.github/services/remotestorage/rsilo/action.yml
b/.github/services/remotestorage/rsilo/action.yml
new file mode 100644
index 0000000000..71bd955a0b
--- /dev/null
+++ b/.github/services/remotestorage/rsilo/action.yml
@@ -0,0 +1,42 @@
+# 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.
+
+name: rsilo
+description: "Behavior test for remoteStorage in RSilo"
+
+runs:
+ using: "composite"
+ steps:
+ - name: Setup RSilo
+ shell: bash
+ working-directory: fixtures/remotestorage
+ run: docker compose -f docker-compose-rsilo.yml up -d --wait
+ - name: Seed read-only fixtures
+ shell: bash
+ working-directory: fixtures/remotestorage
+ run: |
+ # RSilo serves a single account, `alice` in local development.
+ token=$(docker compose -f docker-compose-rsilo.yml exec -T rsilo \
+ bun src/scripts/dev-token.ts alice '*:rw' </dev/null | tail -1)
+ echo "::add-mask::$token"
+ ./seed.sh http://127.0.0.1:8787/storage/alice "$token" /opendal/
+ cat << EOF >> $GITHUB_ENV
+ OPENDAL_REMOTESTORAGE_ENDPOINT=http://127.0.0.1:8787/storage/alice
+ OPENDAL_REMOTESTORAGE_TOKEN=$token
+ OPENDAL_REMOTESTORAGE_ROOT=/opendal/
+ OPENDAL_DISABLE_RANDOM_ROOT=true
+ EOF
diff --git a/README.md b/README.md
index 93e27c6ab0..3b49fd942c 100644
--- a/README.md
+++ b/README.md
@@ -139,7 +139,7 @@ OpenDAL connects to 50+ services through one `Operator`. A
selection by category
| Object storage | s3, gcs, azblob, oss, cos, obs, tos, b2, swift,
vercel-blob, … |
| File storage | fs, hdfs, hdfs-native, webhdfs, azdls, azfile, lakefs, ipfs,
dbfs, … |
| Cloud SaaS | gdrive, dropbox, onedrive, hf, github, aliyun-drive, koofr,
pcloud, … |
-| Standard protocols | http, ftp, webdav, sftp, git |
+| Standard protocols | http, ftp, webdav, sftp, git, remotestorage |
| Databases | sqlite, mysql, postgresql, mongodb, surrealdb, d1, … |
| Key-value and embedded | redis, etcd, tikv, rocksdb, foundationdb,
memcached, moka, foyer, … |
diff --git a/core/Cargo.lock b/core/Cargo.lock
index 85d2b2e05c..1849542d81 100644
--- a/core/Cargo.lock
+++ b/core/Cargo.lock
@@ -7152,6 +7152,7 @@ dependencies = [
"opendal-service-postgresql",
"opendal-service-redb",
"opendal-service-redis",
+ "opendal-service-remotestorage",
"opendal-service-rocksdb",
"opendal-service-s3",
"opendal-service-seafile",
@@ -8425,6 +8426,22 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "opendal-service-remotestorage"
+version = "0.59.5"
+dependencies = [
+ "futures",
+ "http 1.5.0",
+ "log",
+ "opendal-core",
+ "opendal-executor-tokio",
+ "opendal-layer-retry",
+ "percent-encoding",
+ "serde",
+ "serde_json",
+ "tokio",
+]
+
[[package]]
name = "opendal-service-rocksdb"
version = "0.59.5"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 6fab2e82df..90046b3ac9 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -248,6 +248,7 @@ services-redis-native-tls = [
"dep:opendal-service-redis",
"opendal-service-redis?/native-tls",
]
+services-remotestorage = ["dep:opendal-service-remotestorage"]
services-rocksdb = ["dep:opendal-service-rocksdb"]
services-rustfs = ["dep:opendal-service-s3"]
services-s3 = ["dep:opendal-service-s3"]
@@ -382,6 +383,7 @@ opendal-service-persy = { path = "services/persy", version
= "0.59.5", optional
opendal-service-postgresql = { path = "services/postgresql", version =
"0.59.5", optional = true, default-features = false }
opendal-service-redb = { path = "services/redb", version = "0.59.5", optional
= true, default-features = false }
opendal-service-redis = { path = "services/redis", version = "0.59.5",
optional = true, default-features = false }
+opendal-service-remotestorage = { path = "services/remotestorage", version =
"0.59.5", optional = true, default-features = false }
opendal-service-rocksdb = { path = "services/rocksdb", version = "0.59.5",
optional = true, default-features = false }
opendal-service-s3 = { path = "services/s3", version = "0.59.5", optional =
true, default-features = false }
opendal-service-seafile = { path = "services/seafile", version = "0.59.5",
optional = true, default-features = false }
diff --git a/core/services/remotestorage/Cargo.toml
b/core/services/remotestorage/Cargo.toml
new file mode 100644
index 0000000000..4c69ccb176
--- /dev/null
+++ b/core/services/remotestorage/Cargo.toml
@@ -0,0 +1,42 @@
+# 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.
+
+[package]
+description = "Apache OpenDAL remoteStorage service implementation"
+edition = "2024"
+license = "Apache-2.0"
+name = "opendal-service-remotestorage"
+readme = "README.md"
+repository = "https://github.com/apache/opendal"
+version = "0.59.5"
+
+[package.metadata.docs.rs]
+all-features = true
+
+[dependencies]
+http = "1.4"
+log = "0.4"
+opendal-core = { path = "../../core", version = "0.59.5", default-features =
false }
+percent-encoding = "2"
+serde = { version = "1", features = ["derive"] }
+serde_json = { workspace = true }
+
+[dev-dependencies]
+futures = { workspace = true }
+opendal-executor-tokio = { path = "../../executors/tokio", version = "0.59.5" }
+opendal-layer-retry = { path = "../../layers/retry", version = "0.59.5" }
+tokio = { version = "1.52", features = ["macros", "rt-multi-thread"] }
diff --git a/core/services/remotestorage/LICENSE
b/core/services/remotestorage/LICENSE
new file mode 120000
index 0000000000..5853aaea53
--- /dev/null
+++ b/core/services/remotestorage/LICENSE
@@ -0,0 +1 @@
+../../../LICENSE
\ No newline at end of file
diff --git a/core/services/remotestorage/NOTICE
b/core/services/remotestorage/NOTICE
new file mode 120000
index 0000000000..295f6bdb3a
--- /dev/null
+++ b/core/services/remotestorage/NOTICE
@@ -0,0 +1 @@
+../../../NOTICE
\ No newline at end of file
diff --git a/core/services/remotestorage/README.md
b/core/services/remotestorage/README.md
new file mode 100644
index 0000000000..35888f894c
--- /dev/null
+++ b/core/services/remotestorage/README.md
@@ -0,0 +1,56 @@
+# Apache OpenDAL™ remoteStorage Service
+
+`opendal-service-remotestorage` provides access to
[remoteStorage](https://remotestorage.io) servers for applications
+built with Apache OpenDAL™.
+
+## Use through `opendal`
+
+Applications should normally enable this service through the `opendal` facade
with the
+`services-remotestorage` feature:
+
+```shell
+cargo add opendal --features services-remotestorage
+```
+
+The service is available as `opendal::services::RemoteStorage`. Configure the
+service builder, then pass it to `opendal::Operator::new`.
+
+## Use with `opendal-core`
+
+Add the split crates directly:
+
+```shell
+cargo add opendal-core opendal-service-remotestorage
+```
+
+Pass a configured service builder to `Operator::new`:
+
+```rust
+use opendal_core::{Operator, OperatorRegistry, Result};
+use opendal_service_remotestorage::{register_remotestorage_service,
RemoteStorage};
+
+fn build_operator(builder: RemoteStorage) -> Result<Operator> {
+ Operator::new(builder)
+}
+
+fn register_for_uri() {
+ register_remotestorage_service(OperatorRegistry::get());
+}
+```
+
+`register_for_uri` is only needed for scheme-driven construction through
+`Operator::from_uri` or `Operator::via_iter`.
+
+Services that send HTTP requests also require an HTTP transport in
+`OperationContext`. See the
+[`opendal-core` composition example](https://crates.io/crates/opendal-core).
+
+## Documentation
+
+- [Service configuration and
examples](https://opendal.apache.org/services/remotestorage)
+- [Rust API documentation](https://docs.rs/opendal-service-remotestorage)
+- [Apache OpenDAL documentation](https://opendal.apache.org/docs/)
+
+## License
+
+Licensed under the Apache License, Version 2.0.
diff --git a/core/services/remotestorage/src/backend.rs
b/core/services/remotestorage/src/backend.rs
new file mode 100644
index 0000000000..a513d0a747
--- /dev/null
+++ b/core/services/remotestorage/src/backend.rs
@@ -0,0 +1,357 @@
+// 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::sync::Arc;
+
+use http::StatusCode;
+use log::debug;
+
+use super::REMOTESTORAGE_SCHEME;
+use super::config::RemoteStorageConfig;
+use super::core::RemoteStorageCore;
+use super::core::parse_error;
+use super::lister::RemoteStorageLister;
+use super::reader::RemoteStorageReader;
+use opendal_core::raw::*;
+use opendal_core::*;
+
+#[doc = include_str!("docs.md")]
+#[derive(Default)]
+pub struct RemoteStorageBuilder {
+ pub(super) config: RemoteStorageConfig,
+}
+
+impl Debug for RemoteStorageBuilder {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.debug_struct("RemoteStorageBuilder")
+ .field("config", &self.config)
+ .finish_non_exhaustive()
+ }
+}
+
+impl RemoteStorageBuilder {
+ /// Set the storage root URL of the user's account.
+ ///
+ /// This is the `href` of the `remotestorage` link in the user's
+ /// WebFinger record, for example `https://storage.example.com/alice`.
+ pub fn endpoint(mut self, endpoint: &str) -> Self {
+ self.config.endpoint = if endpoint.is_empty() {
+ None
+ } else {
+ Some(endpoint.to_string())
+ };
+ self
+ }
+
+ /// Set the OAuth bearer token granted by the user's storage server.
+ ///
+ /// The token's scope limits which folders the service can access.
+ pub fn token(mut self, token: &str) -> Self {
+ if !token.is_empty() {
+ self.config.token = Some(token.to_string());
+ }
+ self
+ }
+
+ /// Set the origin of the application the token was granted to.
+ ///
+ /// The service sends it as the `Origin` header on every request. Servers
+ /// such as armadietto reject a token with 401 unless the request comes
+ /// from the origin of the `redirect_uri` the token was granted to.
+ ///
+ /// For example: `https://app.example.com`
+ pub fn origin(mut self, origin: &str) -> Self {
+ self.config.origin = if origin.is_empty() {
+ None
+ } else {
+ Some(origin.to_string())
+ };
+ self
+ }
+
+ /// Set the root path inside the storage.
+ ///
+ /// Default: `/`
+ pub fn root(mut self, root: &str) -> Self {
+ self.config.root = if root.is_empty() {
+ None
+ } else {
+ Some(root.to_string())
+ };
+ self
+ }
+}
+
+impl Builder for RemoteStorageBuilder {
+ type Config = RemoteStorageConfig;
+
+ fn build(self) -> Result<impl Service> {
+ debug!("backend build started: {self:?}");
+
+ let Some(endpoint) = self.config.endpoint.as_deref() else {
+ return Err(Error::new(ErrorKind::ConfigInvalid, "endpoint is
empty")
+ .with_context("service", REMOTESTORAGE_SCHEME));
+ };
+ let uri = endpoint.parse::<http::Uri>().map_err(|err| {
+ Error::new(ErrorKind::ConfigInvalid, "endpoint is invalid")
+ .with_context("service", REMOTESTORAGE_SCHEME)
+ .set_source(err)
+ })?;
+ let is_http_scheme = matches!(
+ uri.scheme(),
+ Some(scheme)
+ if *scheme == http::uri::Scheme::HTTP || *scheme ==
http::uri::Scheme::HTTPS
+ );
+ if !is_http_scheme
+ || uri.host().is_none_or(str::is_empty)
+ || uri.query().is_some()
+ || endpoint.contains('#')
+ {
+ return Err(Error::new(
+ ErrorKind::ConfigInvalid,
+ "endpoint must be an http or https URL with a host and no
query or fragment",
+ )
+ .with_context("service", REMOTESTORAGE_SCHEME));
+ }
+ let endpoint = endpoint.trim_end_matches('/').to_string();
+
+ let root = normalize_root(&self.config.root.unwrap_or_default());
+ debug!("backend use root {root}");
+
+ let authorization = self
+ .config
+ .token
+ .as_deref()
+ .map(format_authorization_by_bearer)
+ .transpose()?;
+
+ let origin = match self.config.origin.as_deref() {
+ None => None,
+ Some(origin) => {
+ let uri = origin.parse::<http::Uri>().ok();
+ let is_origin = uri.as_ref().is_some_and(|uri| {
+ matches!(uri.scheme_str(), Some("http" | "https"))
+ && uri.host().is_some_and(|host| !host.is_empty())
+ && matches!(uri.path(), "" | "/")
+ && uri.query().is_none()
+ });
+ if !is_origin {
+ return Err(Error::new(
+ ErrorKind::ConfigInvalid,
+ "origin must be a scheme and host such as
https://app.example.com",
+ )
+ .with_context("service", REMOTESTORAGE_SCHEME));
+ }
+ Some(origin.trim_end_matches('/').to_string())
+ }
+ };
+
+ let capability = Capability {
+ stat: true,
+
+ read: true,
+ read_with_suffix: true,
+ // The specification defines conditional GET for If-None-Match
+ // only; servers ignore If-Match on GET.
+ read_with_if_none_match: true,
+
+ list: true,
+
+ shared: true,
+
+ ..Default::default()
+ };
+
+ Ok(RemoteStorageBackend {
+ core: Arc::new(RemoteStorageCore {
+ info: ServiceInfo::new(REMOTESTORAGE_SCHEME, &root, ""),
+ capability,
+ endpoint,
+ root,
+ authorization,
+ origin,
+ }),
+ })
+ }
+}
+
+#[derive(Clone, Debug)]
+pub struct RemoteStorageBackend {
+ pub(crate) core: Arc<RemoteStorageCore>,
+}
+
+impl Service for RemoteStorageBackend {
+ type Reader = oio::StreamReader<RemoteStorageReader>;
+ type Writer = ();
+ type Lister = oio::PageLister<RemoteStorageLister>;
+ type Deleter = ();
+ type Copier = ();
+ type Composer = ();
+
+ fn info(&self) -> ServiceInfo {
+ self.core.info.clone()
+ }
+
+ fn capability(&self) -> Capability {
+ self.core.capability
+ }
+
+ async fn create_dir(
+ &self,
+ _ctx: &OperationContext,
+ _path: &str,
+ _args: OpCreateDir,
+ ) -> Result<RpCreateDir> {
+ Err(Error::new(
+ ErrorKind::Unsupported,
+ "remoteStorage folders exist only while they contain documents",
+ ))
+ }
+
+ async fn stat(&self, ctx: &OperationContext, path: &str, _args: OpStat) ->
Result<RpStat> {
+ if path == "/" {
+ return Ok(RpStat::new(MetadataBuilder::dir().build()));
+ }
+
+ // A folder exists while it contains at least one document, and an
+ // empty or missing folder lists no items.
+ if path.ends_with('/') {
+ let desc = self.core.list_folder(ctx, Operation::Stat,
path).await?;
+ return if desc.items.is_empty() {
+ Err(Error::new(
+ ErrorKind::NotFound,
+ "remoteStorage folder is empty",
+ ))
+ } else {
+ Ok(RpStat::new(MetadataBuilder::dir().build()))
+ };
+ }
+
+ let resp = self.core.head(ctx, path).await?;
+ match resp.status() {
+ StatusCode::OK => parse_into_metadata(path,
resp.headers()).map(RpStat::new),
+ _ => Err(parse_error(ServiceOperation("Head"), resp)),
+ }
+ }
+
+ fn read(&self, ctx: &OperationContext, path: &str, args: OpRead) ->
Result<Self::Reader> {
+ Ok(oio::StreamReader::new(RemoteStorageReader::new(
+ self.clone(),
+ ctx.clone(),
+ path,
+ args,
+ )))
+ }
+
+ fn write(&self, _ctx: &OperationContext, _path: &str, _args: OpWrite) ->
Result<Self::Writer> {
+ Err(Error::new(
+ ErrorKind::Unsupported,
+ "operation is not supported",
+ ))
+ }
+
+ fn delete(&self, _ctx: &OperationContext) -> Result<Self::Deleter> {
+ Err(Error::new(
+ ErrorKind::Unsupported,
+ "operation is not supported",
+ ))
+ }
+
+ fn list(&self, ctx: &OperationContext, path: &str, _args: OpList) ->
Result<Self::Lister> {
+ Ok(oio::PageLister::new(RemoteStorageLister::new(
+ self.core.clone(),
+ ctx.clone(),
+ path,
+ )))
+ }
+
+ fn copy(
+ &self,
+ _ctx: &OperationContext,
+ _from: &str,
+ _to: &str,
+ _args: OpCopy,
+ ) -> Result<Self::Copier> {
+ Err(Error::new(
+ ErrorKind::Unsupported,
+ "remoteStorage has no server-side copy",
+ ))
+ }
+
+ async fn rename(
+ &self,
+ _ctx: &OperationContext,
+ _from: &str,
+ _to: &str,
+ _args: OpRename,
+ ) -> Result<RpRename> {
+ Err(Error::new(
+ ErrorKind::Unsupported,
+ "remoteStorage has no server-side move",
+ ))
+ }
+
+ async fn presign(
+ &self,
+ _ctx: &OperationContext,
+ _path: &str,
+ _args: OpPresign,
+ ) -> Result<RpPresign> {
+ Err(Error::new(
+ ErrorKind::Unsupported,
+ "operation is not supported",
+ ))
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn builder() -> RemoteStorageBuilder {
+
RemoteStorageBuilder::default().endpoint("https://storage.example.com/alice")
+ }
+
+ #[test]
+ fn build_accepts_origin_with_scheme_and_host() {
+ for origin in [
+ "https://app.example.com",
+ "https://app.example.com/",
+ "http://127.0.0.1:8080",
+ ] {
+ assert!(builder().origin(origin).build().is_ok(),
"origin={origin}");
+ }
+ }
+
+ #[test]
+ fn build_rejects_origin_that_is_not_scheme_and_host() {
+ for origin in [
+ "app.example.com",
+ "ftp://app.example.com",
+ "https://app.example.com/path",
+ "https://app.example.com?x=1",
+ ] {
+ let err = builder()
+ .origin(origin)
+ .build()
+ .err()
+ .unwrap_or_else(|| panic!("origin `{origin}` must be
rejected"));
+ assert_eq!(err.kind(), ErrorKind::ConfigInvalid,
"origin={origin}");
+ }
+ }
+}
diff --git a/core/services/remotestorage/src/config.rs
b/core/services/remotestorage/src/config.rs
new file mode 100644
index 0000000000..ce3a8fde0c
--- /dev/null
+++ b/core/services/remotestorage/src/config.rs
@@ -0,0 +1,121 @@
+// 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;
+
+use super::backend::RemoteStorageBuilder;
+
+/// Config for the remoteStorage service.
+#[derive(Default, Serialize, Deserialize, Clone, PartialEq, Eq)]
+#[serde(default)]
+#[non_exhaustive]
+pub struct RemoteStorageConfig {
+ /// Storage root URL of the user's account, as published in the
+ /// `href` of the user's WebFinger `remotestorage` link.
+ ///
+ /// For example: `https://storage.example.com/alice`
+ ///
+ /// This field is required.
+ ///
+ /// <!-- @example https://storage.example.com/alice -->
+ /// <!-- @required true -->
+ pub endpoint: Option<String>,
+ /// OAuth bearer token granted by the user's storage server.
+ pub token: Option<String>,
+ /// Root path inside the storage, for example `/documents/`.
+ pub root: Option<String>,
+ /// Origin of the application the token was granted to, sent as the
+ /// `Origin` header on every request.
+ ///
+ /// Set this when the server binds tokens to the origin of the
+ /// application's `redirect_uri`, as armadietto does. For example:
+ /// `https://app.example.com`
+ pub origin: Option<String>,
+}
+
+impl Debug for RemoteStorageConfig {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.debug_struct("RemoteStorageConfig")
+ .field("endpoint", &self.endpoint)
+ .field("root", &self.root)
+ .field("origin", &self.origin)
+ .finish_non_exhaustive()
+ }
+}
+
+impl opendal_core::Configurator for RemoteStorageConfig {
+ type Builder = RemoteStorageBuilder;
+
+ /// Parse `remotestorage://<host>/<storage path>?token=...`.
+ ///
+ /// The authority and path form an `https` storage root, because the
+ /// storage root path differs between servers and cannot be told apart
+ /// from an OpenDAL root. Set `root` as a query option.
+ fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
+ let mut map = uri.options().clone();
+ if let Some(authority) = uri.authority() {
+ let endpoint = match uri.root() {
+ Some(path) if !path.is_empty() =>
format!("https://{authority}/{path}"),
+ _ => format!("https://{authority}"),
+ };
+ map.insert("endpoint".to_string(), endpoint);
+ }
+
+ Self::from_iter(map)
+ }
+
+ fn into_builder(self) -> Self::Builder {
+ RemoteStorageBuilder { config: self }
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use opendal_core::Configurator;
+ use opendal_core::OperatorUri;
+
+ #[test]
+ fn from_uri_builds_https_storage_root() {
+ let uri = OperatorUri::new(
+
"remotestorage://storage.example.com/alice?token=abc&root=/documents/",
+ Vec::<(String, String)>::new(),
+ )
+ .unwrap();
+
+ let cfg = RemoteStorageConfig::from_uri(&uri).unwrap();
+ assert_eq!(
+ cfg.endpoint.as_deref(),
+ Some("https://storage.example.com/alice")
+ );
+ assert_eq!(cfg.token.as_deref(), Some("abc"));
+ assert_eq!(cfg.root.as_deref(), Some("/documents/"));
+ }
+
+ #[test]
+ fn debug_redacts_token() {
+ let cfg = RemoteStorageConfig {
+ endpoint: Some("https://storage.example.com/alice".to_string()),
+ token: Some("secret-token".to_string()),
+ ..Default::default()
+ };
+ assert!(!format!("{cfg:?}").contains("secret-token"));
+ }
+}
diff --git a/core/services/remotestorage/src/core.rs
b/core/services/remotestorage/src/core.rs
new file mode 100644
index 0000000000..6b80826068
--- /dev/null
+++ b/core/services/remotestorage/src/core.rs
@@ -0,0 +1,252 @@
+// 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::HashMap;
+use std::fmt::Debug;
+
+use http::Request;
+use http::Response;
+use http::StatusCode;
+use http::header;
+use percent_encoding::AsciiSet;
+use percent_encoding::NON_ALPHANUMERIC;
+use percent_encoding::utf8_percent_encode;
+use serde::Deserialize;
+
+use opendal_core::raw::*;
+use opendal_core::*;
+
+/// Characters left unencoded in request paths: the RFC 3986 unreserved
+/// characters except `~`, plus `/`.
+///
+/// A percent-encoded `~` is equivalent to a raw one (RFC 3986 section 2.3),
+/// so encoding it is always safe.
+const PATH_ENCODE_SET: &AsciiSet = &NON_ALPHANUMERIC
+ .remove(b'-')
+ .remove(b'.')
+ .remove(b'_')
+ .remove(b'/');
+
+pub struct RemoteStorageCore {
+ pub info: ServiceInfo,
+ pub capability: Capability,
+
+ /// Storage root URL without a trailing `/`.
+ pub endpoint: String,
+ pub root: String,
+ pub authorization: Option<String>,
+ /// Sent as the `Origin` header for servers that bind tokens to the
+ /// origin of the application they were granted to.
+ pub origin: Option<String>,
+}
+
+impl Debug for RemoteStorageCore {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.debug_struct("RemoteStorageCore")
+ .field("endpoint", &self.endpoint)
+ .field("root", &self.root)
+ .finish_non_exhaustive()
+ }
+}
+
+impl RemoteStorageCore {
+ fn url(&self, path: &str) -> String {
+ let p = build_rooted_absolute_path(&self.root, path);
+ format!(
+ "{}{}",
+ self.endpoint,
+ utf8_percent_encode(&p, PATH_ENCODE_SET)
+ )
+ }
+
+ fn with_credentials(&self, mut req: http::request::Builder) ->
http::request::Builder {
+ if let Some(auth) = &self.authorization {
+ req = req.header(header::AUTHORIZATION, auth);
+ }
+ if let Some(origin) = &self.origin {
+ req = req.header(header::ORIGIN, origin);
+ }
+ req
+ }
+
+ pub async fn get(
+ &self,
+ ctx: &OperationContext,
+ path: &str,
+ range: BytesRange,
+ args: &OpRead,
+ ) -> Result<Response<HttpBody>> {
+ let mut req = self.with_credentials(Request::get(self.url(path)));
+
+ if let Some(if_none_match) = args.if_none_match() {
+ req = req.header(header::IF_NONE_MATCH, if_none_match);
+ }
+
+ if !range.is_full() {
+ let range_header = range.to_header();
+ if range_header.is_empty() {
+ return Err(Error::new(
+ ErrorKind::RangeNotSatisfied,
+ "range has no valid HTTP Range header representation",
+ )
+ .with_context("offset", range.offset()));
+ }
+ req = req.header(header::RANGE, range_header);
+ }
+
+ let req = req
+ .extension(Operation::Read)
+ .extension(ServiceOperation("Get"))
+ .body(Buffer::new())
+ .map_err(new_request_build_error)?;
+ ctx.http_transport().fetch(req).await
+ }
+
+ pub async fn head(&self, ctx: &OperationContext, path: &str) ->
Result<Response<Buffer>> {
+ let req = self
+ .with_credentials(Request::head(self.url(path)))
+ .extension(Operation::Stat)
+ .extension(ServiceOperation("Head"))
+ .body(Buffer::new())
+ .map_err(new_request_build_error)?;
+ ctx.http_transport().send(req).await
+ }
+
+ /// Fetch the folder description of a folder path ending in `/`.
+ ///
+ /// Servers answer an empty or missing folder with an empty listing, so
+ /// the caller cannot tell the two apart. The specification treats them
+ /// as the same thing.
+ pub async fn list_folder(
+ &self,
+ ctx: &OperationContext,
+ operation: Operation,
+ path: &str,
+ ) -> Result<FolderDescription> {
+ debug_assert!(path.ends_with('/'), "folder path must end with /");
+
+ let req = self
+ .with_credentials(Request::get(self.url(path)))
+ .extension(operation)
+ .extension(ServiceOperation("GetFolder"))
+ .body(Buffer::new())
+ .map_err(new_request_build_error)?;
+ let resp = ctx.http_transport().send(req).await?;
+
+ match resp.status() {
+ StatusCode::OK =>
serde_json::from_slice(&resp.into_body().to_bytes())
+ .map_err(new_json_deserialize_error),
+ // Some servers answer a missing folder with 404 instead of an
+ // empty listing.
+ StatusCode::NOT_FOUND => Ok(FolderDescription::default()),
+ _ => Err(parse_error(ServiceOperation("GetFolder"), resp)),
+ }
+ }
+}
+
+/// Folder description returned by a GET on a folder (draft -02 and later).
+///
+/// Keys of `items` are item names, not URI encoded. Folder names end in `/`.
+#[derive(Debug, Default, Deserialize)]
+pub struct FolderDescription {
+ #[serde(default)]
+ pub items: HashMap<String, FolderItem>,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct FolderItem {
+ #[serde(rename = "ETag")]
+ pub etag: Option<String>,
+ #[serde(rename = "Content-Type")]
+ pub content_type: Option<String>,
+ #[serde(rename = "Content-Length")]
+ pub content_length: Option<u64>,
+ /// Present from draft -11 on.
+ #[serde(rename = "Last-Modified")]
+ pub last_modified: Option<String>,
+}
+
+pub fn parse_error(service_operation: ServiceOperation, resp:
Response<Buffer>) -> Error {
+ let (parts, body) = resp.into_parts();
+ let bs = body.to_bytes();
+
+ let (kind, retryable) = match parts.status {
+ StatusCode::NOT_FOUND => (ErrorKind::NotFound, false),
+ // 401 means the token is missing, invalid or expired; retrying
+ // cannot help and the user must authorize again.
+ StatusCode::UNAUTHORIZED | StatusCode::FORBIDDEN =>
(ErrorKind::PermissionDenied, false),
+ StatusCode::PRECONDITION_FAILED | StatusCode::NOT_MODIFIED => {
+ (ErrorKind::ConditionNotMatch, false)
+ }
+ StatusCode::RANGE_NOT_SATISFIABLE => (ErrorKind::RangeNotSatisfied,
false),
+ StatusCode::TOO_MANY_REQUESTS
+ | StatusCode::INTERNAL_SERVER_ERROR
+ | StatusCode::BAD_GATEWAY
+ | StatusCode::SERVICE_UNAVAILABLE
+ | StatusCode::GATEWAY_TIMEOUT => (ErrorKind::Unexpected, true),
+ _ => (ErrorKind::Unexpected, false),
+ };
+
+ let mut err = Error::new(kind, String::from_utf8_lossy(&bs))
+ .with_context("service_operation", service_operation.0);
+ err = with_error_response_context(err, parts);
+ if retryable {
+ err = err.set_temporary();
+ }
+ err
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn test_core() -> RemoteStorageCore {
+ RemoteStorageCore {
+ info: ServiceInfo::new("remotestorage", "/", ""),
+ capability: Capability::default(),
+ endpoint: "https://storage.example.com/alice".to_string(),
+ root: "/apps/".to_string(),
+ authorization: None,
+ origin: None,
+ }
+ }
+
+ #[test]
+ fn url_encodes_everything_but_unreserved_characters() {
+ let core = test_core();
+ assert_eq!(
+ core.url("my notes?/b [email protected]"),
+
"https://storage.example.com/alice/apps/my%20notes%3F/b%20%7E%40.json"
+ );
+ }
+
+ #[test]
+ fn folder_description_parses_draft_22_listing() {
+ let body = r#"{
+ "@context": "http://remotestorage.io/spec/folder-description",
+ "items": {
+ "a b.txt": {"ETag": "\"e1\"", "Content-Type": "text/plain",
"Content-Length": 12,
+ "Last-Modified": "Sat, 28 Nov 2026 16:19:39 GMT"},
+ "sub/": {"ETag": "e2"}
+ }
+ }"#;
+ let desc: FolderDescription = serde_json::from_str(body).unwrap();
+ assert_eq!(desc.items.len(), 2);
+ assert_eq!(desc.items["a b.txt"].content_length, Some(12));
+ assert!(desc.items["sub/"].content_length.is_none());
+ }
+}
diff --git a/core/services/remotestorage/src/docs.md
b/core/services/remotestorage/src/docs.md
new file mode 100644
index 0000000000..41ac6f1304
--- /dev/null
+++ b/core/services/remotestorage/src/docs.md
@@ -0,0 +1,81 @@
+## Capabilities
+
+Depending on its configuration and the backing system, this service can expose:
+
+- [ ] ~~create_dir~~
+- [x] stat
+- [x] read
+- [ ] ~~write~~
+- [ ] ~~delete~~
+- [x] list
+- [ ] ~~copy~~
+- [ ] ~~rename~~
+- [ ] ~~presign~~
+
+Inspect the effective capability set with [`opendal_core::Operator::info`] and
+[`opendal_core::OperatorInfo::capability`] after building an operator.
+
+## Notes
+
+[remoteStorage](https://remotestorage.io) is an open protocol for per-user
+storage, specified as the IETF draft
+[draft-dejong-remotestorage](https://datatracker.ietf.org/doc/draft-dejong-remotestorage/).
+The service reads folder descriptions in the format introduced in draft -02.
+It is tested against RSilo (draft -27) and armadietto (draft -22).
+
+- **Scope.** The service supports stat, read and list. It does not write or
+ delete documents.
+- **Authorization.** The service sends `token` as an OAuth bearer token. It
+ does not perform WebFinger discovery or the OAuth flow; obtain the storage
+ root URL and a token first, then pass them as `endpoint` and `token`.
+- **Origin.** Some servers, such as armadietto, accept a token only from the
+ origin of the application it was granted to and answer other requests with
+ `PermissionDenied`. Set `origin` to that application's origin, for example
+ `https://app.example.com`, to send it as the `Origin` header.
+- **Folders.** A folder exists only while it contains at least one document.
+ Stat on an empty folder returns `NotFound`, and empty folders are not
+ listed. The service cannot create folders.
+- **Ranged reads.** Range support is optional in remoteStorage, so ranged
+ and suffix reads depend on the server supporting the `Range` header. When a
+ server ignores it and returns the whole document, the read fails with
+ `Unexpected` instead of downloading the document. RSilo and 5apps support
+ ranges; armadietto does not, so read whole documents there.
+- **Conditional reads.** Reads support `if_none_match`. The specification
+ defines no conditional GET for `If-Match`.
+- **Last modified.** Servers on drafts before -11 do not report a
+ last-modified time.
+- **armadietto classic server.** The legacy monolithic armadietto server
+ (draft -10) omits `Content-Length` from HEAD responses, so stat on a
+ document fails
+ ([armadietto#174](https://github.com/remotestorage/armadietto/issues/174)).
+ It also returns percent-encoded folder names in listings
+ ([armadietto#173](https://github.com/remotestorage/armadietto/issues/173)).
+ The current modular armadietto server is not affected.
+
+## Configuration
+
+Use [`crate::RemoteStorageConfig`] for serializable configuration and this
+builder's methods for direct construction. The field and method documentation
+defines accepted values, defaults, and environment interaction.
+
+## Example
+
+### Via Builder
+
+```rust,no_run
+use opendal_core::Operator;
+use opendal_core::Result;
+use opendal_service_remotestorage::RemoteStorage;
+
+#[tokio::main]
+async fn main() -> Result<()> {
+ let builder = RemoteStorage::default()
+ .endpoint("https://storage.example.com/alice")
+ .token("<bearer token>")
+ .origin("https://app.example.com")
+ .root("/documents/");
+
+ let op: Operator = Operator::new(builder)?;
+ Ok(())
+}
+```
diff --git a/core/services/remotestorage/src/lib.rs
b/core/services/remotestorage/src/lib.rs
new file mode 100644
index 0000000000..907aac81d0
--- /dev/null
+++ b/core/services/remotestorage/src/lib.rs
@@ -0,0 +1,43 @@
+// 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.
+
+#![doc = include_str!("../README.md")]
+#![cfg_attr(docsrs, feature(doc_cfg))]
+#![cfg_attr(docsrs, doc(auto_cfg))]
+#![deny(missing_docs)]
+
+mod backend;
+mod config;
+mod core;
+mod lister;
+mod reader;
+
+pub use backend::RemoteStorageBuilder as RemoteStorage;
+pub use config::RemoteStorageConfig;
+
+/// URI scheme used for service registration and scheme-driven construction.
+pub const REMOTESTORAGE_SCHEME: &str = "remotestorage";
+
+/// Register this service's URI scheme with an operator registry.
+///
+/// Registration enables scheme-driven construction through
+/// [`opendal_core::Operator::from_uri`] and
+/// [`opendal_core::Operator::via_iter`]. Direct construction through
+/// [`opendal_core::Operator::new`] does not require registration.
+pub fn register_remotestorage_service(registry:
&opendal_core::OperatorRegistry) {
+ registry.register::<RemoteStorage>(REMOTESTORAGE_SCHEME);
+}
diff --git a/core/services/remotestorage/src/lister.rs
b/core/services/remotestorage/src/lister.rs
new file mode 100644
index 0000000000..94bbe4b947
--- /dev/null
+++ b/core/services/remotestorage/src/lister.rs
@@ -0,0 +1,193 @@
+// 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::sync::Arc;
+
+use super::core::FolderItem;
+use super::core::RemoteStorageCore;
+use opendal_core::raw::oio::Entry;
+use opendal_core::raw::*;
+use opendal_core::*;
+
+pub struct RemoteStorageLister {
+ core: Arc<RemoteStorageCore>,
+ ctx: OperationContext,
+ path: String,
+}
+
+impl RemoteStorageLister {
+ pub(super) fn new(core: Arc<RemoteStorageCore>, ctx: OperationContext,
path: &str) -> Self {
+ Self {
+ core,
+ ctx,
+ path: path.to_string(),
+ }
+ }
+}
+
+impl oio::PageList for RemoteStorageLister {
+ async fn next_page(&self, ctx: &mut oio::PageContext) -> Result<()> {
+ // Folder GETs enumerate one folder. Resolve a partial name in its
parent.
+ let folder = if self.path.ends_with('/') {
+ self.path.as_str()
+ } else {
+ get_parent(&self.path)
+ };
+ let desc = self
+ .core
+ .list_folder(&self.ctx, Operation::List, folder)
+ .await?;
+
+ // A folder description is a single page. Mark the listing done only
+ // after the page is processed, so a retried `next()` after a failed
+ // GET sends the GET again.
+
+ // An empty folder does not exist in remoteStorage.
+ if desc.items.is_empty() {
+ ctx.done = true;
+ return Ok(());
+ }
+
+ if folder == self.path && folder != "/" {
+ ctx.entries
+ .push_back(Entry::new(folder, MetadataBuilder::dir().build()));
+ }
+
+ let prefix = if folder == "/" { "" } else { folder };
+ for (name, item) in desc.items {
+ let path = format!("{prefix}{name}");
+ if folder != self.path && !path.starts_with(&self.path) {
+ continue;
+ }
+ let meta = item_metadata(&path, item)?;
+ ctx.entries.push_back(Entry::new(&path, meta));
+ }
+
+ ctx.done = true;
+ Ok(())
+ }
+}
+
+/// Build metadata from a folder description item.
+fn item_metadata(path: &str, item: FolderItem) -> Result<Metadata> {
+ let mut meta = if path.ends_with('/') {
+ MetadataBuilder::dir()
+ } else {
+ let size = item.content_length.ok_or_else(|| {
+ Error::new(
+ ErrorKind::Unexpected,
+ "remoteStorage folder description has no Content-Length for a
document",
+ )
+ .with_context("path", path)
+ })?;
+ MetadataBuilder::file(size)
+ };
+
+ // Listings carry the bare ETag while response headers quote it. Quote it
+ // so an ETag from a listing works in conditional requests like one from
+ // stat.
+ if let Some(etag) = item.etag {
+ if etag.starts_with('"') {
+ meta.etag(etag);
+ } else {
+ meta.etag(format!("\"{etag}\""));
+ }
+ }
+ if let Some(v) = item.content_type {
+ meta.content_type(v);
+ }
+ if let Some(v) = item.last_modified {
+ meta.last_modified(Timestamp::parse_rfc2822(&v)?);
+ }
+
+ Ok(meta.build())
+}
+
+#[cfg(test)]
+mod tests {
+ use std::sync::Arc;
+ use std::sync::atomic::AtomicUsize;
+ use std::sync::atomic::Ordering;
+ use std::time::Duration;
+
+ use http::Request;
+ use http::Response;
+ use http::StatusCode;
+ use opendal_executor_tokio::TokioExecutor;
+ use opendal_layer_retry::RetryLayer;
+
+ use super::*;
+ use crate::RemoteStorage;
+
+ const LISTING: &str =
r#"{"@context":"http://remotestorage.io/spec/folder-description","items":{"a.txt":{"ETag":"e1","Content-Type":"text/plain","Content-Length":5}}}"#;
+
+ /// Answers the first folder GET with 503 and every later one with a
listing.
+ #[derive(Debug)]
+ struct UnavailableOnce {
+ requests: Arc<AtomicUsize>,
+ }
+
+ impl HttpTransport for UnavailableOnce {
+ async fn fetch(&self, _req: Request<Buffer>) ->
Result<Response<HttpBody>> {
+ let (status, body) = match self.requests.fetch_add(1,
Ordering::SeqCst) {
+ 0 => (StatusCode::SERVICE_UNAVAILABLE, ""),
+ _ => (StatusCode::OK, LISTING),
+ };
+ let size = body.len() as u64;
+ Ok(Response::builder()
+ .status(status)
+ .body(HttpBody::new(
+ futures::stream::iter([Ok(Buffer::from(body))]),
+ Some(size),
+ ))
+ .expect("response must build"))
+ }
+ }
+
+ #[tokio::test]
+ async fn list_retries_folder_get_after_temporary_error() -> Result<()> {
+ let requests = Arc::new(AtomicUsize::new(0));
+ let op = Operator::new(
+ RemoteStorage::default()
+ .endpoint("https://storage.example.com/alice")
+ .token("token"),
+ )?
+ .with_context(
+ OperationContext::new()
+ .with_http_transport(HttpTransporter::new(UnavailableOnce {
+ requests: requests.clone(),
+ }))
+ .with_executor(Executor::with(TokioExecutor::default())),
+ )
+ .layer(
+ RetryLayer::new()
+ .with_min_delay(Duration::from_millis(1))
+ .with_max_times(1),
+ );
+
+ let entries = op.list("docs/").await?;
+
+ assert_eq!(
+ requests.load(Ordering::SeqCst),
+ 2,
+ "the folder GET must be retried"
+ );
+ let paths: Vec<_> = entries.iter().map(|e| e.path()).collect();
+ assert!(paths.contains(&"docs/a.txt"), "entries: {paths:?}");
+ Ok(())
+ }
+}
diff --git a/core/services/remotestorage/src/reader.rs
b/core/services/remotestorage/src/reader.rs
new file mode 100644
index 0000000000..f1e265110a
--- /dev/null
+++ b/core/services/remotestorage/src/reader.rs
@@ -0,0 +1,98 @@
+// 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 http::Response;
+use http::StatusCode;
+
+use super::backend::RemoteStorageBackend;
+use super::core::parse_error;
+use opendal_core::raw::*;
+use opendal_core::*;
+
+pub struct RemoteStorageReader {
+ backend: RemoteStorageBackend,
+ ctx: OperationContext,
+ path: String,
+ args: OpRead,
+}
+
+impl RemoteStorageReader {
+ pub(super) fn new(
+ backend: RemoteStorageBackend,
+ ctx: OperationContext,
+ path: &str,
+ args: OpRead,
+ ) -> Self {
+ Self {
+ backend,
+ ctx,
+ path: path.to_string(),
+ args,
+ }
+ }
+}
+
+impl oio::StreamRead for RemoteStorageReader {
+ async fn open(&self, range: BytesRange) -> Result<(RpRead, Box<dyn
oio::ReadStreamDyn>)> {
+ let path = self.path.as_str();
+ let resp = self
+ .backend
+ .core
+ .get(&self.ctx, path, range, &self.args)
+ .await?;
+
+ match resp.status() {
+ StatusCode::OK if range.is_full() => {
+ let rp = match parse_content_length(resp.headers())? {
+ Some(_) => RpRead::new(parse_into_metadata(path,
resp.headers())?),
+ None => RpRead::default(),
+ };
+ Ok((rp, Box::new(resp.into_body())))
+ }
+ // Range support is optional in remoteStorage (draft section 4).
+ // A server that ignores Range sends the whole document; drop the
+ // body without draining it rather than downloading the prefix.
+ StatusCode::OK => {
+ let (parts, _body) = resp.into_parts();
+ let err = Error::new(
+ ErrorKind::Unexpected,
+ "remoteStorage server returned 200 OK for ranged read
instead of 206 Partial Content",
+ )
+ .with_context("service_operation", "Get")
+ .with_context("range", range.to_header());
+ Err(with_error_response_context(err, parts))
+ }
+ StatusCode::PARTIAL_CONTENT => {
+ // Content-Length is the range length here; only Content-Range
+ // carries the document size.
+ let rp = match
parse_content_range(resp.headers())?.and_then(|v| v.size()) {
+ Some(_) => RpRead::new(parse_into_metadata(path,
resp.headers())?),
+ None => RpRead::default(),
+ };
+ Ok((rp, Box::new(resp.into_body())))
+ }
+ _ => {
+ let (parts, mut body) = resp.into_parts();
+ let buf = body.to_buffer().await?;
+ Err(parse_error(
+ ServiceOperation("Get"),
+ Response::from_parts(parts, buf),
+ ))
+ }
+ }
+ }
+}
diff --git a/core/src/lib.rs b/core/src/lib.rs
index 068c4598dd..ca5927073d 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -296,6 +296,9 @@ fn init_default_registry_inner(registry: &OperatorRegistry)
{
#[cfg(feature = "services-redb")]
opendal_service_redb::register_redb_service(registry);
+ #[cfg(feature = "services-remotestorage")]
+ opendal_service_remotestorage::register_remotestorage_service(registry);
+
#[cfg(feature = "services-rocksdb")]
opendal_service_rocksdb::register_rocksdb_service(registry);
@@ -564,6 +567,8 @@ pub mod services {
pub use opendal_service_redb::*;
#[cfg(feature = "services-redis")]
pub use opendal_service_redis::*;
+ #[cfg(feature = "services-remotestorage")]
+ pub use opendal_service_remotestorage::*;
#[cfg(feature = "services-rocksdb")]
pub use opendal_service_rocksdb::*;
#[cfg(feature = "services-akamai")]
diff --git a/core/tests/behavior/async_read.rs
b/core/tests/behavior/async_read.rs
index ad8b660a2a..b4d1163ca0 100644
--- a/core/tests/behavior/async_read.rs
+++ b/core/tests/behavior/async_read.rs
@@ -75,22 +75,34 @@ pub fn tests(op: &Operator, tests: &mut Vec<Trial>) {
))
}
+ // armadietto ignores Range, so its setup asserts the explicit error
+ // instead of the shared range assertions.
+ let remotestorage_ignores_range = op.info().scheme() == "remotestorage"
+ &&
std::env::var("OPENDAL_TEST_REMOTESTORAGE_IGNORES_RANGE").as_deref() ==
Ok("true");
+
if cap.read && !cap.write {
tests.extend(async_trials!(
op,
test_read_only_read_full,
test_read_only_read_full_with_special_chars,
- test_read_only_read_with_range,
test_read_only_read_not_exist,
test_read_only_read_with_dir_path,
test_read_only_read_with_if_match,
test_read_only_read_with_if_none_match,
test_reader_only_read_with_if_match,
test_reader_only_read_with_if_none_match
- ))
+ ));
+ if remotestorage_ignores_range {
+ tests.extend(async_trials!(
+ op,
+ test_remotestorage_read_only_ignored_range_fails
+ ));
+ } else {
+ tests.extend(async_trials!(op, test_read_only_read_with_range));
+ }
}
- if cap.read && !cap.write && cap.read_with_suffix {
+ if cap.read && !cap.write && cap.read_with_suffix &&
!remotestorage_ignores_range {
tests.extend(async_trials!(op, test_read_only_read_with_suffix))
}
@@ -1197,6 +1209,27 @@ pub async fn test_read_only_read_with_suffix(op:
Operator) -> anyhow::Result<()>
Ok(())
}
+/// A remoteStorage server that ignores Range answers with the whole document.
+/// Offset and suffix reads must fail with a permanent `Unexpected` error.
+pub async fn test_remotestorage_read_only_ignored_range_fails(op: Operator) ->
anyhow::Result<()> {
+ let offset = op.read_with("normal_file.txt").range(1024..2048).await;
+ let suffix = op
+ .read_with("normal_file.txt")
+ .range(BytesRange::suffix(1024))
+ .await;
+
+ for (name, result) in [("offset", offset), ("suffix", suffix)] {
+ let err = result.expect_err("ranged read must fail when the server
ignores Range");
+ assert_eq!(err.kind(), ErrorKind::Unexpected, "{name} range");
+ assert!(
+ !err.is_temporary(),
+ "{name} range error must not be retried"
+ );
+ }
+
+ Ok(())
+}
+
/// Read not exist file should return NotFound
pub async fn test_read_only_read_not_exist(op: Operator) -> anyhow::Result<()>
{
let path = uuid::Uuid::new_v4().to_string();
diff --git a/dev/src/generate/docs.rs b/dev/src/generate/docs.rs
index 8607ca8ab1..01c98c2ba2 100644
--- a/dev/src/generate/docs.rs
+++ b/dev/src/generate/docs.rs
@@ -207,7 +207,8 @@ pub fn generate(workspace_dir: PathBuf, services: Services)
-> Result<()> {
None if binding.id == "go" => {
let s3_preset = scheme != "s3"
&& service.source_dir ==
workspace_dir.join("core/services/s3/src");
- !s3_preset && !matches!(scheme.as_str(), "hdfs-native" |
"hf3fs")
+ !s3_preset
+ && !matches!(scheme.as_str(), "hdfs-native" | "hf3fs"
| "remotestorage")
}
None => true,
Some(set) => set.contains(&scheme),
diff --git a/dev/src/generate/dotnet.rs b/dev/src/generate/dotnet.rs
index 0b3702b6ca..68f7c40943 100644
--- a/dev/src/generate/dotnet.rs
+++ b/dev/src/generate/dotnet.rs
@@ -909,7 +909,8 @@ fn capability_refs(lines: &[String]) -> Vec<String> {
fn enabled_service(srv: &str) -> bool {
match srv {
// not enabled in bindings/dotnet/Cargo.toml
- "foundationdb" | "foyer" | "ftp" | "git" | "hdfs" | "hf3fs" |
"rocksdb" => false,
+ "foundationdb" | "foyer" | "ftp" | "git" | "hdfs" | "hf3fs" |
"remotestorage"
+ | "rocksdb" => false,
_ => true,
}
}
diff --git a/dev/src/generate/java.rs b/dev/src/generate/java.rs
index 3ce10858c6..2ac4c01c66 100644
--- a/dev/src/generate/java.rs
+++ b/dev/src/generate/java.rs
@@ -264,7 +264,8 @@ struct OptionProperty {
fn enabled_service(srv: &str) -> bool {
match srv {
// not enabled in bindings/java/Cargo.toml
- "foundationdb" | "ftp" | "git" | "hdfs" | "hf3fs" | "rocksdb" | "tikv"
=> false,
+ "foundationdb" | "ftp" | "git" | "hdfs" | "hf3fs" | "remotestorage" |
"rocksdb"
+ | "tikv" => false,
_ => true,
}
}
diff --git a/fixtures/remotestorage/docker-compose-armadietto.yml
b/fixtures/remotestorage/docker-compose-armadietto.yml
new file mode 100644
index 0000000000..1147916a95
--- /dev/null
+++ b/fixtures/remotestorage/docker-compose-armadietto.yml
@@ -0,0 +1,67 @@
+# 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.
+
+# armadietto's current (modular) server, which stores documents in S3.
+services:
+ silo:
+ image:
docker.io/pgsty/silo:RELEASE.2026-09-16T00-00-00Z@sha256:635197cb9f36d01bee221d34d1c7d7960f6a95c48b0b6c01d99cd13bdae51a46
+ command: server /data
+ ports:
+ - 127.0.0.1:9000:9000
+ environment:
+ MINIO_ROOT_USER: "minioadmin"
+ MINIO_ROOT_PASSWORD: "minioadmin"
+ healthcheck:
+ test: ["CMD", "silo", "healthcheck", "ready"]
+ interval: 2s
+ timeout: 5s
+ retries: 30
+
+ armadietto:
+ image: docker.io/remotestorage/armadietto-modular:2026-08-29-20-39
+ depends_on:
+ silo:
+ condition: service_healthy
+ ports:
+ - 127.0.0.1:8000:8000
+ environment:
+ S3_ENDPOINT: "http://silo:9000"
+ S3_ACCESS_KEY: "minioadmin"
+ S3_SECRET_KEY: "minioadmin"
+ # Test-only secret; mint_armadietto_token.py signs tokens with it.
+ JWT_SECRET: "opendal-test-jwt-secret"
+ configs:
+ - source: armadietto-conf
+ target: /etc/armadietto/conf.json
+ healthcheck:
+ test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8000/"]
+ interval: 2s
+ timeout: 5s
+ retries: 30
+
+configs:
+ armadietto-conf:
+ content: |
+ {
+ "host_identity": "localhost",
+ "basePath": "",
+ "allow_signup": false,
+ "http": { "host": "0.0.0.0", "port": 8000 },
+ "https": { "enable": false, "force": false },
+ "folder_items_contain_type": true,
+ "logging": { "log_dir": "logs", "stdout": ["info"], "log_files": [] }
+ }
diff --git a/fixtures/remotestorage/docker-compose-rsilo.yml
b/fixtures/remotestorage/docker-compose-rsilo.yml
new file mode 100644
index 0000000000..4390d56d16
--- /dev/null
+++ b/fixtures/remotestorage/docker-compose-rsilo.yml
@@ -0,0 +1,27 @@
+# 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.
+
+services:
+ rsilo:
+ image: ghcr.io/jonocodes/rsilo:0.4.0
+ ports:
+ - 127.0.0.1:8787:8787
+ healthcheck:
+ test: ["CMD", "wget", "-q", "-O", "/dev/null",
"http://127.0.0.1:8787/health"]
+ interval: 2s
+ timeout: 5s
+ retries: 30
diff --git a/fixtures/remotestorage/mint_armadietto_token.py
b/fixtures/remotestorage/mint_armadietto_token.py
new file mode 100755
index 0000000000..853ed92b08
--- /dev/null
+++ b/fixtures/remotestorage/mint_armadietto_token.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python3
+# 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.
+
+"""Sign a storage token for the armadietto test server.
+
+armadietto's modular server only grants tokens through a passkey login, but
+it accepts any HS512 JWT signed with its JWT_SECRET. The `aud` claim is the
+origin of the application the token was granted to; armadietto rejects the
+token unless requests send that origin in the `Origin` header.
+
+Usage: mint_armadietto_token.py <secret> <host_identity> <username> <scopes>
<origin>
+"""
+
+import base64
+import hashlib
+import hmac
+import json
+import sys
+import time
+
+
+def b64(data: bytes) -> str:
+ return base64.urlsafe_b64encode(data).rstrip(b"=").decode()
+
+
+def main() -> None:
+ secret, issuer, username, scopes, origin = sys.argv[1:6]
+ now = int(time.time())
+ claims = {
+ "scopes": scopes,
+ "iss": issuer,
+ "sub": username,
+ "aud": origin,
+ "iat": now,
+ "exp": now + 24 * 60 * 60,
+ }
+ header = {"alg": "HS512", "typ": "JWT"}
+ signing_input =
f"{b64(json.dumps(header).encode())}.{b64(json.dumps(claims).encode())}"
+ signature = hmac.new(secret.encode(), signing_input.encode(),
hashlib.sha512).digest()
+ print(f"{signing_input}.{b64(signature)}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/fixtures/remotestorage/seed.sh b/fixtures/remotestorage/seed.sh
new file mode 100755
index 0000000000..adeae6e93c
--- /dev/null
+++ b/fixtures/remotestorage/seed.sh
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+# 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.
+
+# Upload fixtures/data to a remoteStorage server for read-only behavior tests.
+#
+# seed.sh <storage root URL> <bearer token> <root path> [origin]
+#
+# Pass `origin` when the server binds the token to an application origin.
+#
+# remoteStorage folders exist only while they contain a document, so each
+# empty fixture directory gets a `.keep` document to make it listable.
+set -euo pipefail
+
+endpoint=${1%/}
+token=$2
+root=$(echo "$3" | sed -e 's#^/*#/#' -e 's#/*$#/#')
+origin_header=()
+if [ -n "${4:-}" ]; then
+ origin_header=(-H "Origin: $4")
+fi
+data=$(cd "$(dirname "$0")/../data" && pwd)
+
+encode() {
+ python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1],
safe="/-._"))' "$1"
+}
+
+put() {
+ local rel=$1 file=$2
+ curl -sSf -o /dev/null -X PUT \
+ -H "Authorization: Bearer $token" \
+ "${origin_header[@]}" \
+ -H "Content-Type: application/octet-stream" \
+ --data-binary "@$file" \
+ "$endpoint$(encode "$root$rel")"
+}
+
+cd "$data"
+find . -type f -print0 | while IFS= read -r -d '' f; do
+ put "${f#./}" "$f"
+done
+find . -mindepth 1 -type d -empty -print0 | while IFS= read -r -d '' d; do
+ put "${d#./}/.keep" /dev/null
+done
diff --git a/website/data/capabilities.json b/website/data/capabilities.json
index 04c080a2e6..37359b927c 100644
--- a/website/data/capabilities.json
+++ b/website/data/capabilities.json
@@ -3629,6 +3629,18 @@
"write_with_expires": true
}
},
+ {
+ "name": "remotestorage",
+ "scheme": "remotestorage",
+ "native": {
+ "list": true,
+ "read": true,
+ "read_with_if_none_match": true,
+ "read_with_suffix": true,
+ "shared": true,
+ "stat": true
+ }
+ },
{
"name": "rocksdb",
"scheme": "rocksdb",
diff --git a/website/data/services.json b/website/data/services.json
index 8aaca44057..575de50dfb 100644
--- a/website/data/services.json
+++ b/website/data/services.json
@@ -6260,6 +6260,52 @@
}
]
},
+ {
+ "name": "remotestorage",
+ "scheme": "remotestorage",
+ "groups": [
+ "General"
+ ],
+ "configs": [
+ {
+ "name": "endpoint",
+ "type": "string",
+ "required": true,
+ "group": "General",
+ "example": "https://storage.example.com/alice",
+ "comments": "Storage root URL of the user's account, as published in
the\n`href` of the user's WebFinger `remotestorage` link.\n\nFor example:
`https://storage.example.com/alice`\n\nThis field is required."
+ },
+ {
+ "name": "token",
+ "type": "string",
+ "required": false,
+ "group": "General",
+ "comments": "OAuth bearer token granted by the user's storage
server."
+ },
+ {
+ "name": "root",
+ "type": "string",
+ "required": false,
+ "group": "General",
+ "comments": "Root path inside the storage, for example
`/documents/`."
+ },
+ {
+ "name": "origin",
+ "type": "string",
+ "required": false,
+ "group": "General",
+ "comments": "Origin of the application the token was granted to,
sent as the\n`Origin` header on every request.\n\nSet this when the server
binds tokens to the origin of the\napplication's `redirect_uri`, as armadietto
does. For example:\n`https://app.example.com`"
+ }
+ ],
+ "examples": [
+ {
+ "binding": "rust",
+ "language": "rust",
+ "minimal": "use opendal::Operator;\n\nlet operator =
Operator::via_iter(\"remotestorage\", [\n (\"endpoint\".to_string(),
\"https://storage.example.com/alice\".to_string()),\n])?;",
+ "full": "use opendal::Operator;\n\nlet operator =
Operator::via_iter(\"remotestorage\", [\n // Storage root URL of the user's
account, as published in the\n // `href` of the user's WebFinger
`remotestorage` link.\n //\n // For example:
`https://storage.example.com/alice`\n //\n // This field is required.\n
(\"endpoint\".to_string(),
\"https://storage.example.com/alice\".to_string()),\n\n // OAuth bearer
token granted by the user's storage server.\n // [...]
+ }
+ ]
+ },
{
"name": "rocksdb",
"scheme": "rocksdb",