pub struct SupervisorConfig { /* private fields */ }Expand description
Runtime configuration for the supervisor and actors.
Controls channel buffer sizes and event batching behavior. Use the builder
pattern to customize, or use Default for sensible defaults.
§Examples
use maiko::SupervisorConfig;
let config = SupervisorConfig::default()
.with_broker_channel_capacity(512) // Larger broker buffer
.with_default_actor_channel_capacity(256) // Larger actor mailboxes
.with_default_max_events_per_tick(20); // Process more events per cycleImplementations§
Source§impl SupervisorConfig
impl SupervisorConfig
Sourcepub fn with_broker_channel_capacity(self, capacity: usize) -> Self
pub fn with_broker_channel_capacity(self, capacity: usize) -> Self
Set the per-actor channel capacity for stage 1 (actor to broker).
Sourcepub fn broker_channel_capacity(&self) -> usize
pub fn broker_channel_capacity(&self) -> usize
Returns the per-actor channel capacity for stage 1 (actor to broker).
Sourcepub fn with_default_max_events_per_tick(self, limit: usize) -> Self
pub fn with_default_max_events_per_tick(self, limit: usize) -> Self
Set the default maximum events processed per tick cycle for new actors.
This controls batching behavior in the actor event loop.
After processing this many events, the actor yields to allow
other tasks to run and to call Actor::step.
Trade-offs:
- Lower values (1-5): Better fairness, more responsive
step(), higher overhead - Higher values (50-100): Better throughput, potential starvation of
step()
Sourcepub fn default_max_events_per_tick(&self) -> usize
pub fn default_max_events_per_tick(&self) -> usize
Returns the default maximum events processed per tick.
Sourcepub fn with_monitoring_channel_capacity(self, capacity: usize) -> Self
pub fn with_monitoring_channel_capacity(self, capacity: usize) -> Self
Set the buffer size for the monitoring event channel.
Sourcepub fn monitoring_channel_capacity(&self) -> usize
pub fn monitoring_channel_capacity(&self) -> usize
Returns the monitoring event channel capacity.
Sourcepub fn with_default_actor_channel_capacity(self, capacity: usize) -> Self
pub fn with_default_actor_channel_capacity(self, capacity: usize) -> Self
Set the default mailbox channel capacity for new actors (stage 2).
Sourcepub fn default_actor_channel_capacity(&self) -> usize
pub fn default_actor_channel_capacity(&self) -> usize
Returns the default mailbox channel capacity for new actors.
Trait Implementations§
Source§impl Clone for SupervisorConfig
impl Clone for SupervisorConfig
Source§fn clone(&self) -> SupervisorConfig
fn clone(&self) -> SupervisorConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more