This is an automated email from the ASF dual-hosted git repository. koushiro pushed a commit to branch extract-tail-cut-layer in repository https://gitbox.apache.org/repos/asf/opendal.git
commit 94af62b6ff9cfb9f3c710df8e9a745a4955ed9f5 Author: koushiro <[email protected]> AuthorDate: Thu Dec 11 14:33:31 2025 +0800 refactor: Split tail-cut layer to new crate --- core/Cargo.lock | 9 +++++ core/Cargo.toml | 2 ++ core/core/src/layers/mod.rs | 4 --- core/layers/tail-cut/Cargo.toml | 39 ++++++++++++++++++++++ .../tail_cut.rs => layers/tail-cut/src/lib.rs} | 25 ++++++++------ core/src/lib.rs | 2 ++ 6 files changed, 66 insertions(+), 15 deletions(-) diff --git a/core/Cargo.lock b/core/Cargo.lock index b8671c60a..dedc6fb39 100644 --- a/core/Cargo.lock +++ b/core/Cargo.lock @@ -5490,6 +5490,7 @@ dependencies = [ "opendal-layer-otelmetrics", "opendal-layer-prometheus", "opendal-layer-prometheus-client", + "opendal-layer-tail-cut", "opendal-service-aliyun-drive", "opendal-service-azblob", "opendal-service-azdls", @@ -5740,6 +5741,14 @@ dependencies = [ "prometheus-client", ] +[[package]] +name = "opendal-layer-tail-cut" +version = "0.55.0" +dependencies = [ + "opendal-core", + "tokio", +] + [[package]] name = "opendal-service-aliyun-drive" version = "0.55.0" diff --git a/core/Cargo.toml b/core/Cargo.toml index cae8ccce8..6a4cc491d 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -99,6 +99,7 @@ layers-otel-metrics = ["dep:opendal-layer-otelmetrics"] layers-otel-trace = ["opendal-core/layers-otel-trace"] layers-prometheus = ["dep:opendal-layer-prometheus"] layers-prometheus-client = ["dep:opendal-layer-prometheus-client"] +layers-tail-cut = ["dep:opendal-layer-tail-cut"] layers-throttle = ["opendal-core/layers-throttle"] layers-tracing = ["opendal-core/layers-tracing"] reqwest-rustls-tls = ["opendal-core/reqwest-rustls-tls"] @@ -195,6 +196,7 @@ opendal-layer-metrics = { path = "layers/metrics", version = "0.55.0", optional opendal-layer-otelmetrics = { path = "layers/otelmetrics", version = "0.55.0", optional = true, default-features = false } opendal-layer-prometheus = { path = "layers/prometheus", version = "0.55.0", optional = true, default-features = false } opendal-layer-prometheus-client = { path = "layers/prometheus-client", version = "0.55.0", optional = true, default-features = false } +opendal-layer-tail-cut = { path = "layers/tail-cut", 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-service-aliyun-drive = { path = "services/aliyun-drive", version = "0.55.0", optional = true, default-features = false } opendal-service-azblob = { path = "services/azblob", 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 4b1012ff6..80d48d2d7 100644 --- a/core/core/src/layers/mod.rs +++ b/core/core/src/layers/mod.rs @@ -56,10 +56,6 @@ mod retry; pub use self::retry::RetryInterceptor; pub use self::retry::RetryLayer; -mod tail_cut; -pub use self::tail_cut::TailCutLayer; -pub use self::tail_cut::TailCutLayerBuilder; - #[cfg(feature = "layers-tracing")] mod tracing; #[cfg(feature = "layers-tracing")] diff --git a/core/layers/tail-cut/Cargo.toml b/core/layers/tail-cut/Cargo.toml new file mode 100644 index 000000000..6e67b2739 --- /dev/null +++ b/core/layers/tail-cut/Cargo.toml @@ -0,0 +1,39 @@ +# 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 tail-cut layer" +name = "opendal-layer-tail-cut" + +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] +opendal-core = { path = "../../core", version = "0.55.0", default-features = false } +tokio = { workspace = true, features = ["time"] } + +[dev-dependencies] +opendal-core = { path = "../../core", version = "0.55.0" } +tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } diff --git a/core/core/src/layers/tail_cut.rs b/core/layers/tail-cut/src/lib.rs similarity index 98% rename from core/core/src/layers/tail_cut.rs rename to core/layers/tail-cut/src/lib.rs index ae5189d25..3ecaedbaa 100644 --- a/core/core/src/layers/tail_cut.rs +++ b/core/layers/tail-cut/src/lib.rs @@ -20,8 +20,8 @@ use std::fmt::Formatter; use std::sync::Arc; use std::sync::atomic::{AtomicU64, AtomicUsize, Ordering}; -use crate::raw::*; -use crate::*; +use opendal_core::raw::*; +use opendal_core::*; /// Builder for TailCutLayer. /// @@ -31,12 +31,13 @@ use crate::*; /// # Examples /// /// ```no_run -/// use opendal_core::layers::TailCutLayer; -/// use std::time::Duration; +/// # use std::time::Duration; +/// # /// # use opendal_core::services; /// # use opendal_core::Operator; /// # use opendal_core::Result; -/// +/// # use opendal_layer_tail_cut::TailCutLayer; +/// # /// # fn main() -> Result<()> { /// let layer = TailCutLayer::builder() /// .percentile(95) @@ -174,12 +175,13 @@ impl TailCutLayerBuilder { /// # Examples /// /// ```no_run - /// use opendal_core::layers::TailCutLayer; - /// use std::time::Duration; + /// # use std::time::Duration; + /// # /// # use opendal_core::services; /// # use opendal_core::Operator; /// # use opendal_core::Result; - /// + /// # use opendal_layer_tail_cut::TailCutLayer; + /// # /// # fn main() -> Result<()> { /// let layer = TailCutLayer::builder() /// .percentile(95) @@ -235,12 +237,13 @@ struct TailCutConfig { /// # Examples /// /// ```no_run -/// use opendal_core::layers::TailCutLayer; -/// use std::time::Duration; +/// # use std::time::Duration; +/// # /// # use opendal_core::services; /// # use opendal_core::Operator; /// # use opendal_core::Result; -/// +/// # use opendal_layer_tail_cut::TailCutLayer; +/// # /// # fn main() -> Result<()> { /// let layer = TailCutLayer::builder() /// .percentile(95) diff --git a/core/src/lib.rs b/core/src/lib.rs index 594e9d079..433839216 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -66,4 +66,6 @@ pub mod layers { pub use opendal_layer_prometheus::*; #[cfg(feature = "layers-prometheus-client")] pub use opendal_layer_prometheus_client::*; + #[cfg(feature = "layers-tail-cut")] + pub use opendal_layer_tail_cut::*; }
