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)]
6#[allow(clippy::large_enum_variant)] // Preserve direct backend construction in the public API.
7pub enum ExecutionMode {
8    #[default]
9    Inline,
10    Threaded {
11        max_workers: usize,
12    },
13    Distributed(DistributedBackend),
14}
15
16impl From<ExecutionMode> for RuntimeExecutionBackend {
17    fn from(mode: ExecutionMode) -> Self {
18        match mode {
19            ExecutionMode::Inline => Self::Inline(InlineBackend),
20            ExecutionMode::Threaded { max_workers } => {
21                Self::Thread(ThreadBackend::new(max_workers))
22            }
23            ExecutionMode::Distributed(backend) => Self::Distributed(backend),
24        }
25    }
26}