pub struct ContainerHandle { /* private fields */ }Expand description
Handle to the exact container started for an approved spec. Dropping the
handle kills the attached client; use ContainerHandle::terminate to
deterministically remove the exact container.
Implementations§
Source§impl ContainerHandle
impl ContainerHandle
Sourcepub async fn launch(
spec: &ContainerSpec,
) -> Result<(Self, ChildStdout, ChildStdin)>
pub async fn launch( spec: &ContainerSpec, ) -> Result<(Self, ChildStdout, ChildStdin)>
Start the approved container and return its pipes for the driver.
The tuple order matches crate::browser::BrowserDriver::connect:
the handle, the reply stream, then the command stream.
§Errors
Returns an error if docker is unavailable, the container cannot be
started, or its identity cannot be established.
Sourcepub async fn terminate(&self) -> Result<TerminateOutcome>
pub async fn terminate(&self) -> Result<TerminateOutcome>
Remove the exact container, succeeding when it is already gone. Call this on Stop, failure, and teardown paths; dropping the handle only stops the attached client. The caller reports the outcome with the trigger that caused it, so teardown stays auditable.
Removed means this call ensured removal; AlreadyGone means the
container was observably absent before attempting it.
§Errors
Returns an error if docker is unavailable, a step times out, or
the container is still present afterwards.