| 112 | |
| 113 | #[async_trait(?Send)] |
| 114 | pub trait Executor { |
| 115 | fn name(&self) -> ExecutorName; |
| 116 | |
| 117 | /// Report the installation status of the tool(s) this executor depends on. |
| 118 | fn tool_status(&self) -> Option<ToolStatus>; |
| 119 | |
| 120 | /// Report whether the elevated privileges this executor needs are in place. |
| 121 | /// Defaults to `None` for executors that need none. Only consulted once the |
| 122 | /// tool itself is installed. |
| 123 | fn privilege_status(&self) -> Option<PrivilegeStatus> { |
| 124 | None |
| 125 | } |
| 126 | |
| 127 | /// Declare how well this executor runs on the host system. Drives whether `setup()` is invoked |
| 128 | /// (only when [`ExecutorSupport::FullySupported`]) and whether we bail out of running the |
| 129 | /// executor at all (on [`ExecutorSupport::Unsupported`]). |
| 130 | fn support_level(&self, system_info: &SystemInfo) -> ExecutorSupport; |
| 131 | |
| 132 | async fn setup( |
| 133 | &self, |
| 134 | _system_info: &SystemInfo, |
| 135 | _setup_cache_dir: Option<&Path>, |
| 136 | _run_environment: &RunEnvironment, |
| 137 | ) -> Result<()> { |
| 138 | Ok(()) |
| 139 | } |
| 140 | |
| 141 | /// Grant any elevated privileges this executor needs (e.g. file capabilities). |
| 142 | /// Runs after [`setup`](Self::setup) and may prompt for sudo. Defaults to a |
| 143 | /// no-op for executors that need none. |
| 144 | fn grant_privileges(&self) -> Result<()> { |
| 145 | Ok(()) |
| 146 | } |
| 147 | |
| 148 | /// Runs the executor |
| 149 | async fn run( |
| 150 | &mut self, |
| 151 | execution_context: &ExecutionContext, |
| 152 | // TODO: use Instruments instead of directly passing the mongodb tracer |
| 153 | mongo_tracer: &Option<MongoTracer>, |
| 154 | ) -> Result<()>; |
| 155 | |
| 156 | async fn teardown(&self, execution_context: &ExecutionContext) -> Result<()>; |
| 157 | } |
| 158 | |
| 159 | /// Run a single executor: setup → run → teardown → persist logs. |
| 160 | /// Does NOT upload. |
no outgoing calls
no test coverage detected