This is an automated email from the ASF dual-hosted git repository. psiace pushed a commit to branch split-concurrent-limit in repository https://gitbox.apache.org/repos/asf/opendal.git
commit e8cbcf81ddd21eb56fddd6aea24d8a13d41d977c Author: Chojan Shang <[email protected]> AuthorDate: Sat Dec 20 03:28:58 2025 +0800 refactor: split concurrent-limit layer as a crate Signed-off-by: Chojan Shang <[email protected]> --- core/Cargo.lock | 11 ++++++ core/Cargo.toml | 3 ++ core/core/src/layers/mod.rs | 3 -- core/layers/concurrent-limit/Cargo.toml | 40 ++++++++++++++++++++++ .../concurrent-limit/src/lib.rs} | 8 ++--- core/src/lib.rs | 2 ++ 6 files changed, 60 insertions(+), 7 deletions(-) diff --git a/core/Cargo.lock b/core/Cargo.lock index c1863cdc0..0cb3b703f 100644 --- a/core/Cargo.lock +++ b/core/Cargo.lock @@ -5538,6 +5538,7 @@ dependencies = [ "opendal-layer-await-tree", "opendal-layer-capability-check", "opendal-layer-chaos", + "opendal-layer-concurrent-limit", "opendal-layer-fastmetrics", "opendal-layer-fastrace", "opendal-layer-immutable-index", @@ -5762,6 +5763,16 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "opendal-layer-concurrent-limit" +version = "0.55.0" +dependencies = [ + "futures", + "http 1.4.0", + "mea", + "opendal-core", +] + [[package]] name = "opendal-layer-fastmetrics" version = "0.55.0" diff --git a/core/Cargo.toml b/core/Cargo.toml index 559817cf5..afc5b43d1 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -82,6 +82,7 @@ blocking = ["opendal-core/blocking"] default = [ "reqwest-rustls-tls", "executors-tokio", + "layers-concurrent-limit", "layers-logging", "layers-retry", "layers-timeout", @@ -94,6 +95,7 @@ layers-async-backtrace = ["dep:opendal-layer-async-backtrace"] layers-await-tree = ["dep:opendal-layer-await-tree"] layers-capability-check = ["dep:opendal-layer-capability-check"] layers-chaos = ["dep:opendal-layer-chaos"] +layers-concurrent-limit = ["dep:opendal-layer-concurrent-limit"] layers-dtrace = ["opendal-core/layers-dtrace"] layers-fastmetrics = ["dep:opendal-layer-fastmetrics"] layers-fastrace = ["dep:opendal-layer-fastrace"] @@ -200,6 +202,7 @@ opendal-layer-async-backtrace = { path = "layers/async-backtrace", version = "0. opendal-layer-await-tree = { path = "layers/await-tree", version = "0.55.0", optional = true, default-features = false } opendal-layer-capability-check = { path = "layers/capability-check", version = "0.55.0", optional = true, default-features = false } opendal-layer-chaos = { path = "layers/chaos", version = "0.55.0", optional = true, default-features = false } +opendal-layer-concurrent-limit = { path = "layers/concurrent-limit", version = "0.55.0", optional = true, default-features = false } opendal-layer-fastmetrics = { path = "layers/fastmetrics", version = "0.55.0", optional = true, default-features = false } opendal-layer-fastrace = { path = "layers/fastrace", version = "0.55.0", optional = true, default-features = false } opendal-layer-immutable-index = { path = "layers/immutable-index", version = "0.55.0", optional = true, default-features = false } diff --git a/core/core/src/layers/mod.rs b/core/core/src/layers/mod.rs index 5d1f6e0df..2deaef274 100644 --- a/core/core/src/layers/mod.rs +++ b/core/core/src/layers/mod.rs @@ -29,9 +29,6 @@ pub(crate) use complete::CompleteLayer; mod simulate; pub use simulate::SimulateLayer; -mod concurrent_limit; -pub use concurrent_limit::ConcurrentLimitLayer; - #[cfg(all(target_os = "linux", feature = "layers-dtrace"))] mod dtrace; #[cfg(all(target_os = "linux", feature = "layers-dtrace"))] diff --git a/core/layers/concurrent-limit/Cargo.toml b/core/layers/concurrent-limit/Cargo.toml new file mode 100644 index 000000000..da80d3e45 --- /dev/null +++ b/core/layers/concurrent-limit/Cargo.toml @@ -0,0 +1,40 @@ +# 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 concurrent limit layer" +name = "opendal-layer-concurrent-limit" + +authors = { workspace = true } +edition = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +repository = { workspace = true } +rust-version = { workspace = true } +version = { workspace = true } + +[package.metadata.docs.rs] +all-features = true + +[dependencies] +futures = { workspace = true } +http = { workspace = true } +mea = "0.5.1" +opendal-core = { path = "../../core", version = "0.55.0", default-features = false } + +[dev-dependencies] +opendal-core = { path = "../../core", version = "0.55.0" } diff --git a/core/core/src/layers/concurrent_limit.rs b/core/layers/concurrent-limit/src/lib.rs similarity index 97% rename from core/core/src/layers/concurrent_limit.rs rename to core/layers/concurrent-limit/src/lib.rs index e3a6f4ecb..bde32113e 100644 --- a/core/core/src/layers/concurrent_limit.rs +++ b/core/layers/concurrent-limit/src/lib.rs @@ -26,8 +26,8 @@ use futures::StreamExt; use mea::semaphore::OwnedSemaphorePermit; use mea::semaphore::Semaphore; -use crate::raw::*; -use crate::*; +use opendal_core::raw::*; +use opendal_core::*; /// Add concurrent request limit. /// @@ -46,7 +46,7 @@ use crate::*; /// Add a concurrent limit layer to the operator: /// /// ```no_run -/// # use opendal_core::layers::ConcurrentLimitLayer; +/// # use opendal_layer_concurrent_limit::ConcurrentLimitLayer; /// # use opendal_core::services; /// # use opendal_core::Operator; /// # use opendal_core::Result; @@ -62,7 +62,7 @@ use crate::*; /// Share a concurrent limit layer between the operators: /// /// ```no_run -/// # use opendal_core::layers::ConcurrentLimitLayer; +/// # use opendal_layer_concurrent_limit::ConcurrentLimitLayer; /// # use opendal_core::services; /// # use opendal_core::Operator; /// # use opendal_core::Result; diff --git a/core/src/lib.rs b/core/src/lib.rs index ccc4d0b51..d8dbbad4e 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -151,6 +151,8 @@ pub mod layers { pub use opendal_layer_capability_check::*; #[cfg(feature = "layers-chaos")] pub use opendal_layer_chaos::*; + #[cfg(feature = "layers-concurrent-limit")] + pub use opendal_layer_concurrent_limit::*; #[cfg(feature = "layers-fastmetrics")] pub use opendal_layer_fastmetrics::*; #[cfg(feature = "layers-fastrace")]
