Skip to main content

rustfs_io_core/
lib.rs

1// Copyright 2024 RustFS Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Shared I/O primitives for RustFS.
16//!
17//! This crate holds the buffer pool and the concurrency-control primitives
18//! that the storage layer builds on:
19//!
20//! - Tiered `BytesPool` for buffer management
21//! - Storage-media and access-pattern profiling (`io_profile`)
22//! - Scheduler and priority-queue configuration shapes
23//! - Backpressure admission, deadlock detection, lock optimization
24//! - Progress tracking for long-running operations
25//!
26//! # Example
27//!
28//! ```ignore
29//! use rustfs_io_core::BytesPool;
30//!
31//! let pool = BytesPool::new_tiered();
32//! let mut buffer = pool.acquire_buffer(8192).await;
33//! ```
34
35pub mod backpressure;
36pub mod config;
37pub mod deadlock_detector;
38pub mod io_profile;
39pub mod lock_optimizer;
40pub mod pool;
41pub mod progress;
42
43pub use pool::{BytesPool, BytesPoolConfig, BytesPoolMetrics, PooledBuffer};
44
45// Config exports
46pub use config::{ConfigError, IoPriorityQueueConfig, IoSchedulerConfig};
47
48// Backpressure exports
49pub use backpressure::{BackpressureConfig, BackpressureError, BackpressureMonitor, BackpressureState};
50
51// Deadlock detector exports
52pub use deadlock_detector::{DeadlockDetector, DeadlockDetectorConfig, LockInfo, LockType, WaitGraphEdge};
53
54// Lock optimizer exports
55pub use lock_optimizer::{LockGuard, LockOptimizeConfig, LockOptimizer, LockStats};
56
57// Progress tracking exports
58pub use progress::OperationProgress;