Skip to main content

vv_agent/
execution_mode.rs

1use crate::runtime::backends::{
2    DistributedBackend, InlineBackend, RuntimeExecutionBackend, ThreadBackend,
3};
4
5#[derive(Debug, Clone, Default)]
6pub enum ExecutionMode {
7    #[default]
8    Inline,
9    Threaded {
10        max_workers: usize,
11    },
12    Distributed(DistributedBackend),
13}
14
15impl From<ExecutionMode> for RuntimeExecutionBackend {
16    fn from(mode: ExecutionMode) -> Self {
17        match mode {
18            ExecutionMode::Inline => Self::Inline(InlineBackend),
19            ExecutionMode::Threaded { max_workers } => {
20                Self::Thread(ThreadBackend::new(max_workers))
21            }
22            ExecutionMode::Distributed(backend) => Self::Distributed(backend),
23        }
24    }
25}