Skip to main content

moirai_core/channel/
config.rs

1//! Configuration for unified channels.
2
3/// Default ring buffer capacity (power of 2)
4pub const DEFAULT_RING_BUFFER_CAPACITY: usize = 1024;
5
6/// Channel configuration for unified memory management
7#[derive(Debug, Clone)]
8pub struct ChannelConfig {
9    /// Buffer capacity (will be rounded to power of 2)
10    pub capacity: usize,
11    /// Whether to use memory pooling for overflow
12    pub enable_pooling: bool,
13    /// Maximum pool size for overflow handling
14    pub max_pool_size: usize,
15    /// Whether to enable batch operations
16    pub enable_batching: bool,
17    /// Batch size for bulk operations
18    pub batch_size: usize,
19}
20
21impl Default for ChannelConfig {
22    fn default() -> Self {
23        Self {
24            capacity: DEFAULT_RING_BUFFER_CAPACITY,
25            enable_pooling: true,
26            max_pool_size: DEFAULT_RING_BUFFER_CAPACITY * 2,
27            enable_batching: false,
28            batch_size: 64,
29        }
30    }
31}