Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

[workspace]
default-members = [".", "core"]
members = [".", "core", "examples/*", "fuzz", "edge/*", "benches/vs_*"]
members = [".", "core", "examples/*", "fuzz", "edge/*", "benches/vs_*", "services/*"]

[workspace.package]
edition = "2024"
Expand Down Expand Up @@ -116,7 +116,7 @@ services-redb = ["opendal-core/services-redb"]
services-redis = ["opendal-core/services-redis"]
services-redis-native-tls = ["opendal-core/services-redis-native-tls"]
services-rocksdb = ["opendal-core/services-rocksdb"]
services-s3 = ["opendal-core/services-s3"]
services-s3 = ["dep:opendal-service-s3"]
services-seafile = ["opendal-core/services-seafile"]
services-sftp = ["opendal-core/services-sftp"]
services-sled = ["opendal-core/services-sled"]
Expand Down Expand Up @@ -152,6 +152,7 @@ required-features = ["tests"]

[dependencies]
opendal-core = { path = "core", version = "0.55.0", default-features = false }
opendal-service-s3 = { path = "services/s3", version = "0.55.0", optional = true, default-features = false }

[dev-dependencies]
anyhow = { version = "1.0.100", features = ["std"] }
Expand Down
15 changes: 0 additions & 15 deletions core/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ tests = [
"services-http",
"services-memory",
"internal-tokio-rt",
"services-s3",
]

# Enable path cache.
Expand Down Expand Up @@ -191,13 +190,6 @@ services-redb = ["dep:redb", "internal-tokio-rt"]
services-redis = ["dep:redis", "dep:fastpool", "redis?/tokio-rustls-comp"]
services-redis-native-tls = ["services-redis", "redis?/tokio-native-tls-comp"]
services-rocksdb = ["dep:rocksdb", "internal-tokio-rt"]
services-s3 = [
"dep:reqsign-core",
"dep:reqsign-aws-v4",
"dep:reqsign-file-read-tokio",
"dep:reqsign-http-send-reqwest",
"dep:crc32c",
]
services-seafile = []
services-sftp = ["dep:openssh", "dep:openssh-sftp-client", "dep:fastpool"]
services-sled = ["dep:sled", "internal-tokio-rt"]
Expand Down Expand Up @@ -262,11 +254,6 @@ sqlx = { version = "0.8.0", features = [

# For http based services.
reqsign = { version = "0.16.5", default-features = false, optional = true }
# For S3 service migration to v1
reqsign-aws-v4 = { version = "2.0.1", default-features = false, optional = true }
reqsign-core = { version = "2.0.1", default-features = false, optional = true }
reqsign-file-read-tokio = { version = "2.0.1", default-features = false, optional = true }
reqsign-http-send-reqwest = { version = "2.0.1", default-features = false, optional = true }

# for self-referencing structs
ouroboros = { version = "0.18.4", optional = true }
Expand Down Expand Up @@ -339,8 +326,6 @@ compio = { version = "0.16.0", optional = true, features = [
"polling",
"dispatcher",
] }
# for services-s3
crc32c = { version = "0.6.6", optional = true }
# for services-monoiofs
flume = { version = "0.11", optional = true }
monoio = { version = "0.2.4", optional = true, features = [
Expand Down
6 changes: 3 additions & 3 deletions core/core/src/blocking/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use crate::*;
/// #[tokio::main]
/// async fn main() -> Result<()> {
/// // Create fs backend builder.
/// let mut builder = services::S3::default().bucket("test").region("us-east-1");
/// let builder = services::Memory::default();
/// let op = Operator::new(builder)?.finish();
///
/// // Build an `blocking::Operator` with blocking layer to start operating the storage.
Expand Down Expand Up @@ -75,7 +75,7 @@ use crate::*;
///
/// fn blocking_fn() -> Result<blocking::Operator> {
/// // Create fs backend builder.
/// let mut builder = services::S3::default().bucket("test").region("us-east-1");
/// let builder = services::Memory::default();
/// let op = Operator::new(builder)?.finish();
///
/// let handle = tokio::runtime::Handle::try_current().unwrap();
Expand Down Expand Up @@ -109,7 +109,7 @@ use crate::*;
///
/// fn main() -> Result<()> {
/// // Create fs backend builder.
/// let mut builder = services::S3::default().bucket("test").region("us-east-1");
/// let builder = services::Memory::default();
/// let op = Operator::new(builder)?.finish();
///
/// // Fetch the `EnterGuard` from global runtime.
Expand Down
20 changes: 7 additions & 13 deletions core/core/src/docs/concepts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,16 @@
//! └───────────┘ └───────────┘
//! ```
//!
//! All [`Builder`] provided by OpenDAL is under [`services`][crate::services], we can refer to them like `opendal::services::S3`.
//! All [`Builder`] provided by OpenDAL is under [`services`][crate::services], we can refer to them like `opendal::services::Memory`.
//! By right the builder will be named like `OneServiceBuilder`, but usually we will export it to public with renaming it as one
//! general name. For example, we will rename `S3Builder` to `S3` and developer will use `S3` finally.
//!
//! For example:
//!
//! ```no_run
//! use opendal_core::services::S3;
//! use opendal_core::services::Memory;
//!
//! let mut builder = S3::default();
//! builder.bucket("example");
//! builder.root("/path/to/file");
//! let builder = Memory::default();
//! ```
//!
//! # Operator
Expand All @@ -79,13 +77,11 @@
//!
//! ```no_run
//! # use opendal_core::Result;
//! use opendal_core::services::S3;
//! use opendal_core::services::Memory;
//! use opendal_core::Operator;
//!
//! # fn test() -> Result<()> {
//! let mut builder = S3::default();
//! builder.bucket("example");
//! builder.root("/path/to/file");
//! let builder = Memory::default();
//!
//! let op = Operator::new(builder)?.finish();
//! # Ok(())
Expand Down Expand Up @@ -117,13 +113,11 @@
//!
//! ```no_run
//! # use opendal_core::Result;
//! use opendal_core::services::S3;
//! use opendal_core::services::Memory;
//! use opendal_core::Operator;
//!
//! # async fn test() -> Result<()> {
//! let mut builder = S3::default();
//! builder.bucket("example");
//! builder.root("/path/to/file");
//! let builder = Memory::default();
//!
//! let op = Operator::new(builder)?.finish();
//! let bs: Vec<u8> = op.read("abc").await?;
Expand Down
2 changes: 1 addition & 1 deletion core/core/src/layers/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use crate::*;
/// // Create a custom HTTP client
/// let custom_client = HttpClient::new()?;
///
/// let op = Operator::new(services::S3::default())?
/// let op = Operator::new(services::Memory::default())?
/// .layer(HttpClientLayer::new(custom_client))
/// .finish();
/// # Ok(())
Expand Down
8 changes: 4 additions & 4 deletions core/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
//! The first step is to pick a service and init it with a builder. All supported
//! services could be found at [`services`].
//!
//! Let's take [`services::S3`] as an example:
//! Let's take [`services::Memory`] as an example:
//!
//! ```no_run
//! use opendal_core::services;
Expand All @@ -47,7 +47,7 @@
//!
//! fn main() -> Result<()> {
//! // Pick a builder and configure it.
//! let mut builder = services::S3::default().bucket("test");
//! let builder = services::Memory::default();
//!
//! // Init an operator
//! let op = Operator::new(builder)?.finish();
Expand All @@ -72,7 +72,7 @@
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! // Pick a builder and configure it.
//! let mut builder = services::S3::default().bucket("test");
//! let builder = services::Memory::default();
//!
//! // Init an operator
//! let op = Operator::new(builder)?
Expand Down Expand Up @@ -111,7 +111,7 @@
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! // Pick a builder and configure it.
//! let mut builder = services::S3::default().bucket("test");
//! let builder = services::Memory::default();
//!
//! // Init an operator
//! let op = Operator::new(builder)?
Expand Down
5 changes: 0 additions & 5 deletions core/core/src/services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,6 @@ mod rocksdb;
#[cfg(feature = "services-rocksdb")]
pub use self::rocksdb::*;

#[cfg(feature = "services-s3")]
mod s3;
#[cfg(feature = "services-s3")]
pub use s3::*;

#[cfg(feature = "services-seafile")]
mod seafile;
#[cfg(feature = "services-seafile")]
Expand Down
27 changes: 0 additions & 27 deletions core/core/src/types/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,33 +93,6 @@ impl Builder for () {
/// Ok(())
/// }
/// ```
///
/// Some service builder might contain in memory options like `http_client` . Users can call
/// `into_builder` to convert the configuration into a builder instead.
///
/// ```
/// # use anyhow::Result;
/// use std::collections::HashMap;
///
/// use opendal_core::raw::HttpClient;
/// use opendal_core::services::S3Config;
/// use opendal_core::Configurator;
/// use opendal_core::Operator;
///
/// async fn test() -> Result<()> {
/// let mut cfg = S3Config::default();
/// cfg.root = Some("/".to_string());
/// cfg.bucket = "test".to_string();
///
/// let builder = cfg.into_builder();
/// let builder = builder.http_client(HttpClient::new()?);
///
/// // Build an `Operator` to start operating the storage.
/// let op: Operator = Operator::new(builder)?.finish();
///
/// Ok(())
/// }
/// ```
pub trait Configurator: Serialize + DeserializeOwned + Debug + 'static {
/// Associated builder for this configuration.
type Builder: Builder;
Expand Down
2 changes: 1 addition & 1 deletion core/core/src/types/mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl EntryMode {

/// Create entry mode from given path.
#[allow(dead_code)]
pub(crate) fn from_path(path: &str) -> Self {
pub fn from_path(path: &str) -> Self {
if path.ends_with('/') {
EntryMode::DIR
} else {
Expand Down
6 changes: 3 additions & 3 deletions core/core/src/types/operator/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ use crate::*;
///
/// Users can initialize an `Operator` through the following methods:
///
/// - [`Operator::new`]: Creates an operator using a [`services`] builder, such as [`services::S3`].
/// - [`Operator::from_config`]: Creates an operator using a [`services`] configuration, such as [`services::S3Config`].
/// - [`Operator::new`]: Creates an operator using a [`services`] builder, such as [`services::Memory`].
/// - [`Operator::from_config`]: Creates an operator using a [`services`] configuration, such as [`services::MemoryConfig`].
/// - [`Operator::from_iter`]: Creates an operator from an iterator of configuration key-value pairs.
///
/// ```
Expand Down Expand Up @@ -110,7 +110,7 @@ use crate::*;
/// #[tokio::main]
/// async fn main() -> Result<()> {
/// // Pick a builder and configure it.
/// let mut builder = services::S3::default().bucket("test");
/// let builder = services::Memory::default();
///
/// // Init an operator
/// let op = Operator::new(builder)?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rust-version.workspace = true
version.workspace = true

[dependencies]
opendal = { path = "../..", features = ["tests"] }
opendal = { path = "../..", features = ["tests", "services-s3"] }
tokio = { version = "1", features = ["full"] }
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
uuid = { version = "1", features = ["serde", "v4"] }
50 changes: 50 additions & 0 deletions core/services/s3/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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]
name = "opendal-service-s3"
version = "0.55.0"
edition = "2024"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
description = "Apache OpenDAL S3 service implementation"

[package.metadata.docs.rs]
all-features = true

[dependencies]
opendal-core = { path = "../../core", version = "0.55.0", default-features = false }
base64 = "0.22"
bytes = "1.6"
crc32c = "0.6.6"
ctor = "0.6"
http = "1.1"
log = "0.4"
md-5 = "0.10"
quick-xml = { version = "0.38", features = ["serialize", "overlapped-lists"] }
reqsign-aws-v4 = { version = "2.0.1", default-features = false }
reqsign-core = { version = "2.0.1", default-features = false }
reqsign-file-read-tokio = { version = "2.0.1", default-features = false }
reqsign-http-send-reqwest = { version = "2.0.1", default-features = false }
reqwest = { version = "0.12.24", features = ["stream"], default-features = false }
serde = { version = "1", features = ["derive"] }

[dev-dependencies]
pretty_assertions = "1"
tracing-subscriber = "0.3"
tokio = { version = "1.48", features = ["macros", "rt-multi-thread", "io-util"] }
serde_json = "1"
Loading
Loading