Start a managed sandbox container that was previously stopped. Used by the gateway to resume sandboxes after a restart so that running state in the gateway store is matched by an actually-running container. Returns `Ok(true)` when a container existed and was started (or was already running), `Ok(false)` when no managed container is found for the sandbox, and `Err(...)` for any Docker failure.
(
&self,
sandbox_id: &str,
sandbox_name: &str,
)
| 957 | /// already running), `Ok(false)` when no managed container is found for |
| 958 | /// the sandbox, and `Err(...)` for any Docker failure. |
| 959 | pub async fn resume_sandbox( |
| 960 | &self, |
| 961 | sandbox_id: &str, |
| 962 | sandbox_name: &str, |
| 963 | ) -> Result<bool, Status> { |
| 964 | let Some(container) = self |
| 965 | .find_managed_container_summary(sandbox_id, sandbox_name) |
| 966 | .await? |
| 967 | else { |
| 968 | return Ok(false); |
| 969 | }; |
| 970 | let Some(target) = summary_container_target(&container) else { |
| 971 | return Ok(false); |
| 972 | }; |
| 973 | let state = container.state.unwrap_or(ContainerSummaryStateEnum::EMPTY); |
| 974 | if !container_state_needs_resume(state) { |
| 975 | return Ok(true); |
| 976 | } |
| 977 | |
| 978 | match self.docker.start_container(&target, None).await { |
| 979 | Ok(()) => Ok(true), |
| 980 | // Already running — race with another resume path or the |
| 981 | // restart policy. Treat as success. |
| 982 | Err(err) if is_not_modified_error(&err) => Ok(true), |
| 983 | Err(err) if is_not_found_error(&err) => Ok(false), |
| 984 | Err(err) => Err(internal_status("start docker sandbox container", err)), |
| 985 | } |
| 986 | } |
| 987 | |
| 988 | pub async fn stop_managed_containers_on_shutdown(&self) -> Result<usize, Status> { |
| 989 | let containers = self.list_managed_container_summaries().await?; |
nothing calls this directly
no test coverage detected