common/config.rs
1//! Configuration types for runtime and execution settings
2
3/// Runtime configuration for tokio and thread pools
4#[derive(Debug, Clone, Copy, Default)]
5pub struct RuntimeConfig {
6    /// Number of worker threads (0 = number of CPU cores)
7    pub max_workers: usize,
8    /// Number of blocking threads (0 = tokio default of 512)
9    pub max_blocking_threads: usize,
10}
11
12/// Throttling configuration for resource control
13#[derive(Debug, Clone, Copy, Default)]
14pub struct ThrottleConfig {
15    /// Maximum number of open files (None = 80% of system limit)
16    pub max_open_files: Option<usize>,
17    /// Operations per second throttle (0 = no throttle)
18    pub ops_throttle: usize,
19    /// I/O operations per second throttle (0 = no throttle)
20    pub iops_throttle: usize,
21    /// Chunk size for I/O operations (bytes)
22    pub chunk_size: u64,
23}
24
25impl ThrottleConfig {
26    /// Validate configuration and return errors if invalid
27    pub fn validate(&self) -> Result<(), String> {
28        if self.iops_throttle > 0 && self.chunk_size == 0 {
29            return Err("chunk_size must be specified when using iops_throttle".to_string());
30        }
31        Ok(())
32    }
33}
34
35/// Output and logging configuration
36#[derive(Debug, Clone, Copy, Default)]
37pub struct OutputConfig {
38    /// Suppress error output
39    pub quiet: bool,
40    /// Verbosity level: 0=ERROR, 1=INFO, 2=DEBUG, 3=TRACE
41    pub verbose: u8,
42    /// Print summary statistics at the end
43    pub print_summary: bool,
44}
45
46/// Tracing configuration for debugging
47#[derive(Debug, Default)]
48pub struct TracingConfig {
49    /// Remote tracing layer for distributed tracing
50    pub remote_layer: Option<crate::remote_tracing::RemoteTracingLayer>,
51    /// Debug log file path
52    pub debug_log_file: Option<String>,
53}