Files
rustfs/crates/concurrency/src/lib.rs
T
Zhengchao An 05833063c7 refactor(concurrency): remove zero-caller facade modules, fix feature build (#4530)
refactor(concurrency): remove zero-caller facade modules and fix no-default-features build (backlog#1025)

The audit in rustfs/backlog#1010 (consistent with #805) established that most of crates/concurrency was a decorative facade with zero production callers; the real runtime concurrency control lives in rustfs/src/storage/*. This deletes the dead facades and keeps only what the workspace actually consumes.

Deleted (zero callers verified by workspace-wide grep):
- manager.rs: ConcurrencyManager, lifecycle start/stop, misleading 'started' lifecycle logs
- config.rs: ConcurrencyConfig, ConcurrencyFeatures, from_env
- timeout.rs: TimeoutManager, TimeoutGuard, TimeoutManagerPolicy
- lock.rs: LockManager, LockScopeGuard, OptimizedLockGuard
- scheduler.rs: SchedulerManager, SchedulerPolicy, IoStrategy
- deadlock.rs facade: DeadlockManager, RequestTracker
- backpressure.rs facade: BackpressureManager, BackpressurePipe
- the prelude module, unused io-core re-exports, and all feature flags

Kept (real callers in ecstore/heal/rustfs):
- workload.rs admission contract types (unchanged)
- workers.rs Workers pool (unchanged, retained per #4498)
- GetObjectQueueSnapshot (moved from manager.rs to new queue.rs)
- PipeBackpressurePolicy (used by rustfs/src/storage/backpressure.rs)
- DeadlockMonitorPolicy (used by rustfs/src/storage/deadlock_detector.rs)
- OperationProgress re-export (used by rustfs/src/storage/timeout_wrapper.rs)

Removing the feature flags fixes the previously broken cargo check -p rustfs-concurrency --no-default-features (E0432). Docs and the logging guardrail file list are updated to match.

Ref: rustfs/backlog#1025
2026-07-09 01:12:43 +08:00

52 lines
2.0 KiB
Rust

// 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.
//! # RustFS Concurrency Contracts
//!
//! Shared concurrency contract types for RustFS:
//!
//! - [`workload`]: workload admission snapshot/contract types consumed by
//! ecstore, heal, and the server for admission-aware throttling.
//! - [`GetObjectQueueSnapshot`]: disk permit queue usage snapshot for
//! GetObject orchestration.
//! - [`workers`]: a bounded semaphore-backed worker-slot pool.
//! - [`PipeBackpressurePolicy`] / [`DeadlockMonitorPolicy`]: policy types
//! shared with the runtime implementations.
//!
//! The actual runtime concurrency control — size-aware timeouts, byte-watermark
//! backpressure, request-hang/deadlock detection, and I/O scheduling — is
//! implemented in `rustfs/src/storage/*` on top of the `rustfs-io-core`
//! primitives. This crate only carries the data and contract types those
//! implementations share; it does not run any background tasks itself.
#![deny(missing_docs)]
#![deny(unsafe_code)]
// Re-exported io-core type used by downstream timeout implementations.
pub use rustfs_io_core::OperationProgress;
mod backpressure;
mod deadlock;
mod queue;
pub mod workers;
pub mod workload;
pub use backpressure::PipeBackpressurePolicy;
pub use deadlock::DeadlockMonitorPolicy;
pub use queue::GetObjectQueueSnapshot;
pub use workload::{
AdmissionState, WorkloadAdmissionRegistrySnapshot, WorkloadAdmissionSnapshot, WorkloadAdmissionSnapshotProvider,
WorkloadClass,
};