mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-06 12:09:12 +00:00
1dd81cf276
Add `tee_reader` / `tee_reader_with_options` in `rustfs-rio`: a `TeePrimary` that drives the source and a `TeeSecondary` that observes an identical copy of every chunk through a byte-bounded queue. The primary returns `Pending` when the queue is full, so both sides advance at the pace of the slowest consumer; it is meant for small objects only. Termination: source EOF and errors propagate to the secondary with the same `io::ErrorKind`; dropping the secondary turns the primary into a pass-through; dropping the primary early fails the secondary with `BrokenPipe` by default, or hands the remaining source to a background drain task bounded by `max_drain_bytes` when `TeeOptions::drain_on_primary_drop` is set. `TeeSecondary::into_stream` exposes the queued `Bytes` chunks without an extra copy. Includes a proptest equivalence test, backpressure, error, drop, drain-limit and cancel-safety tests, and a criterion bench comparing tee throughput against a direct read (64 MiB in 1 MiB chunks).
105 lines
3.4 KiB
TOML
105 lines
3.4 KiB
TOML
# Copyright 2024 RustFS Team
|
|
#
|
|
# Licensed 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 = "rustfs-rio"
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
rust-version.workspace = true
|
|
version.workspace = true
|
|
homepage.workspace = true
|
|
description = "Rio is a RustFS component that provides a high-performance, asynchronous I/O framework for building scalable and efficient applications."
|
|
keywords = ["asynchronous", "IO", "framework", "rustfs", "Minio"]
|
|
categories = ["web-programming", "development-tools", "asynchronous"]
|
|
documentation = "https://docs.rs/rustfs-rio/latest/rustfs_rio/"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[features]
|
|
default = []
|
|
hotpath = [
|
|
"hotpath/hotpath",
|
|
"hotpath/tokio",
|
|
"hotpath/futures",
|
|
"hotpath/reqwest-0-13",
|
|
"rustfs-config/hotpath",
|
|
"rustfs-io-metrics/hotpath",
|
|
"rustfs-tls-runtime/hotpath",
|
|
"rustfs-utils/hotpath",
|
|
]
|
|
hotpath-alloc = [
|
|
"hotpath",
|
|
"hotpath/hotpath-alloc",
|
|
"rustfs-config/hotpath-alloc",
|
|
"rustfs-io-metrics/hotpath-alloc",
|
|
"rustfs-tls-runtime/hotpath-alloc",
|
|
"rustfs-utils/hotpath-alloc",
|
|
]
|
|
hotpath-cpu = [
|
|
"hotpath",
|
|
"hotpath/hotpath-cpu",
|
|
"rustfs-config/hotpath-cpu",
|
|
"rustfs-io-metrics/hotpath-cpu",
|
|
"rustfs-tls-runtime/hotpath-cpu",
|
|
"rustfs-utils/hotpath-cpu",
|
|
]
|
|
|
|
[dependencies]
|
|
hotpath.workspace = true
|
|
arc-swap.workspace = true
|
|
tokio = { workspace = true, features = ["io-util", "macros", "net", "rt-multi-thread", "sync", "time"] }
|
|
rand = { workspace = true, features = ["serde"] }
|
|
http.workspace = true
|
|
aes-gcm = { workspace = true, features = ["rand_core"] }
|
|
crc-fast = { workspace = true }
|
|
pin-project-lite.workspace = true
|
|
serde = { workspace = true, features = ["derive"] }
|
|
bytes = { workspace = true, features = ["serde"] }
|
|
reqwest = { workspace = true, features = ["stream"] }
|
|
rustls-pki-types.workspace = true
|
|
tokio-util = { workspace = true, features = ["io", "compat"] }
|
|
faster-hex.workspace = true
|
|
futures.workspace = true
|
|
rustfs-config = { workspace = true, features = ["constants"] }
|
|
rustfs-io-metrics.workspace = true
|
|
rustfs-tls-runtime.workspace = true
|
|
rustfs-utils = { workspace = true, features = ["io", "hash", "compress"] }
|
|
serde_json = { workspace = true, features = ["raw_value"] }
|
|
md-5 = { workspace = true }
|
|
minlz.workspace = true
|
|
tracing.workspace = true
|
|
thiserror.workspace = true
|
|
base64-simd.workspace = true
|
|
sha1.workspace = true
|
|
sha2.workspace = true
|
|
xxhash-rust = { workspace = true, features = ["xxh64", "xxh3"] }
|
|
s3s = { workspace = true, features = ["minio"] }
|
|
hex-simd.workspace = true
|
|
|
|
[dev-dependencies]
|
|
tokio = { workspace = true, features = ["test-util"] }
|
|
tokio-test = { workspace = true }
|
|
criterion = { workspace = true, features = ["html_reports"] }
|
|
proptest = { workspace = true }
|
|
axum = { workspace = true }
|
|
hyper = { workspace = true, features = ["http2", "server"] }
|
|
hyper-util = { workspace = true, features = ["tokio"] }
|
|
http-body-util = { workspace = true }
|
|
|
|
[[bench]]
|
|
name = "tee_reader"
|
|
harness = false
|