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