use num_cpus;
#[derive(Default)]
pub struct ActorSystemConfig {
pub executor_config: ExecutorConfig,
}
impl ActorSystemConfig {
pub fn validate(&self) -> Result<(), String> {
self.executor_config.validate()
}
}
pub struct ExecutorConfig {
pub num_executors: usize,
pub executor_type: ExecutorType,
}
pub enum ExecutorType {
Thread,
}
impl ExecutorConfig {
pub fn validate(&self) -> Result<(), String> {
if self.num_executors == 0 {
return Err("num_executors must be greater than 0".to_string());
}
Ok(())
}
}
impl Default for ExecutorConfig {
fn default() -> Self {
ExecutorConfig {
num_executors: num_cpus::get(),
executor_type: ExecutorType::Thread,
}
}
}