use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PerformanceConfig {
pub enable_adaptive_batching: bool,
pub max_batch_size: usize,
pub target_latency_ms: u64,
pub enable_memory_pooling: bool,
pub memory_pool_size: usize,
pub enable_zero_copy: bool,
pub enable_parallel_processing: bool,
pub parallel_workers: usize,
pub enable_event_filtering: bool,
pub enable_compression: bool,
pub compression_threshold: usize,
pub enable_adaptive_compression: bool,
pub estimated_bandwidth: u64,
}
impl Default for PerformanceConfig {
fn default() -> Self {
Self {
enable_adaptive_batching: true,
max_batch_size: 1000,
target_latency_ms: 10,
enable_memory_pooling: true,
memory_pool_size: 1024 * 1024 * 10, enable_zero_copy: true,
enable_parallel_processing: true,
parallel_workers: num_cpus::get().max(1),
enable_event_filtering: true,
enable_compression: true,
compression_threshold: 1024, enable_adaptive_compression: true,
estimated_bandwidth: 100 * 1024 * 1024, }
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EnhancedMLConfig {
pub enable_enhanced_ml: bool,
pub learning_rate: f64,
pub training_epochs: usize,
pub ml_batch_size: usize,
pub hidden_layer_size: usize,
pub enable_feature_engineering: bool,
pub enable_polynomial_features: bool,
pub polynomial_degree: usize,
pub enable_interaction_features: bool,
pub enable_temporal_features: bool,
pub enable_statistical_features: bool,
pub enable_model_selection: bool,
pub cv_folds: usize,
pub enable_feature_scaling: bool,
pub performance_window: usize,
}
impl Default for EnhancedMLConfig {
fn default() -> Self {
Self {
enable_enhanced_ml: true,
learning_rate: 0.01,
training_epochs: 100,
ml_batch_size: 32,
hidden_layer_size: 64,
enable_feature_engineering: true,
enable_polynomial_features: true,
polynomial_degree: 2,
enable_interaction_features: true,
enable_temporal_features: true,
enable_statistical_features: true,
enable_model_selection: true,
cv_folds: 5,
enable_feature_scaling: true,
performance_window: 1000,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BatchConfig {
pub initial_batch_size: usize,
pub min_batch_size: usize,
pub max_batch_size: usize,
pub adjustment_factor: f64,
pub target_latency_ms: u64,
pub latency_tolerance_ms: u64,
}
impl Default for BatchConfig {
fn default() -> Self {
Self {
initial_batch_size: 100,
min_batch_size: 10,
max_batch_size: 1000,
adjustment_factor: 1.2,
target_latency_ms: 10,
latency_tolerance_ms: 2,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MemoryPoolConfig {
pub initial_size: usize,
pub max_size: usize,
pub growth_factor: f64,
pub shrink_threshold: f64,
pub enable_compaction: bool,
pub compaction_interval: u64,
}
impl Default for MemoryPoolConfig {
fn default() -> Self {
Self {
initial_size: 1024 * 1024, max_size: 100 * 1024 * 1024, growth_factor: 1.5,
shrink_threshold: 0.7,
enable_compaction: true,
compaction_interval: 60,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ParallelConfig {
pub worker_threads: usize,
pub queue_capacity: usize,
pub enable_work_stealing: bool,
pub load_balancing: LoadBalancingStrategy,
pub enable_thread_pinning: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum LoadBalancingStrategy {
RoundRobin,
LeastLoaded,
Random,
Weighted(Vec<f64>),
}
impl Default for ParallelConfig {
fn default() -> Self {
Self {
worker_threads: num_cpus::get().max(1),
queue_capacity: 1000,
enable_work_stealing: true,
load_balancing: LoadBalancingStrategy::LeastLoaded,
enable_thread_pinning: false,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompressionConfig {
pub enable_compression: bool,
pub algorithm: CompressionAlgorithm,
pub level: u32,
pub threshold: usize,
pub enable_adaptive: bool,
pub bandwidth_threshold: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum CompressionAlgorithm {
Gzip,
Zstd,
Lz4,
Snappy,
Brotli,
}
impl Default for CompressionConfig {
fn default() -> Self {
Self {
enable_compression: true,
algorithm: CompressionAlgorithm::Zstd,
level: 3,
threshold: 1024, enable_adaptive: true,
bandwidth_threshold: 10 * 1024 * 1024, }
}
}