pub struct DockerBackend { /* private fields */ }Expand description
Drives the Docker daemon over DockerClient. See the module docs for the shape.
Implementations§
Source§impl DockerBackend
impl DockerBackend
Sourcepub fn connecting_to_env() -> Self
pub fn connecting_to_env() -> Self
Builds a backend pointed at the daemon DOCKER_HOST (or the default socket)
names — the same resolution crate::DockerBackendProvider’s create uses,
exposed directly for callers that want a concrete DockerBackend without
going through rightsize::backends::resolve (integration tests, mainly).
Trait Implementations§
Source§impl SandboxBackend for DockerBackend
impl SandboxBackend for DockerBackend
Source§fn name(&self) -> &str
fn name(&self) -> &str
The backend’s human id, e.g.
"docker" / "microsandbox" — shown in errors and
matched against RIGHTSIZE_BACKEND.Source§fn supports_native_networks(&self) -> bool
fn supports_native_networks(&self) -> bool
True when the runtime has real container networks; false means network links are
emulated (see
SandboxBackend::install_network_links).Source§fn create<'life0, 'async_trait>(
&'life0 self,
spec: ContainerSpec,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn SandboxHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create<'life0, 'async_trait>(
&'life0 self,
spec: ContainerSpec,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn SandboxHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates (but does not start) a container from
spec. spec.ports are already
chosen — this call binds them, it never allocates.Source§fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Starts a container previously returned by
SandboxBackend::create.Source§fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stops a running container. Safe to call on an already-stopped one.
Source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Removes a stopped container’s resources.
Source§fn exec<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
cmd: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<ExecResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn exec<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
cmd: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<ExecResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Runs
cmd inside the running container and returns its exit code plus captured
output.Source§fn logs<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn logs<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The container’s full captured logs so far.
Source§fn follow_logs<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
consumer: Box<dyn Fn(String) + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<FollowHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn follow_logs<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 dyn SandboxHandle,
consumer: Box<dyn Fn(String) + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<FollowHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Streams log lines to
consumer as they arrive. Read moreSource§fn ensure_network<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ensure_network<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates the named network if the runtime needs an explicit create step; no-op
otherwise.
Source§fn remove_network<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_network<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Removes the named network; no-op for runtimes with nothing to remove.
Source§fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Best-effort teardown of backend-owned resources (client sockets, etc.), called
once when the backend itself is being retired — not per-container.
Source§fn cleanup_sync(&self, container_id: &str)
fn cleanup_sync(&self, container_id: &str)
SYNCHRONOUS SIGKILL-safe teardown for the
Drop-path cleanup thread (see
crate::cleanup). Given a container id/name, tears it down with blocking std I/O
only — never Tokio, never block_on — because this runs on a dedicated OS thread
with no async runtime in context. Called only from that thread, never from async
code.Source§fn install_network_links<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_handle: &'life1 dyn SandboxHandle,
_links: &'life2 [NetworkLink],
) -> Pin<Box<dyn Future<Output = Result<(), RightsizeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn install_network_links<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_handle: &'life1 dyn SandboxHandle,
_links: &'life2 [NetworkLink],
) -> Pin<Box<dyn Future<Output = Result<(), RightsizeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Called after
start, before the wait strategy runs, to make links reachable
from handle by alias. Read moreAuto Trait Implementations§
impl !Freeze for DockerBackend
impl RefUnwindSafe for DockerBackend
impl Send for DockerBackend
impl Sync for DockerBackend
impl Unpin for DockerBackend
impl UnsafeUnpin for DockerBackend
impl UnwindSafe for DockerBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more