pub struct LocalRuntime {
pub detected: DetectedRuntime,
pub docker_host: String,
}Expand description
Reachable local container daemon — the winning provider from the cascade.
Fields§
§detected: DetectedRuntime§docker_host: StringDOCKER_HOST value used for every docker CLI invocation against this
runtime (e.g. "unix:///…" or "tcp://localhost:2375").
Implementations§
Source§impl LocalRuntime
impl LocalRuntime
Sourcepub async fn detect(spec: &LocalContainerSpec) -> Result<LocalRuntime, Error>
pub async fn detect(spec: &LocalContainerSpec) -> Result<LocalRuntime, Error>
Probe providers in spec.runtime order. Auto walks the full cascade
orbstack → docker-desktop → colima → podman → docker → custom; a
pinned preference probes only that runtime. Each socket path is
tilde-expanded and existence-checked.
Sourcepub async fn has_image(&self, image: &str) -> Result<bool, Error>
pub async fn has_image(&self, image: &str) -> Result<bool, Error>
True if image is already present in the local image store.
docker image inspect returns non-zero (without ‘unable to find’ on
stderr) when the image is absent.
Sourcepub async fn ensure_image(&self, image: &str) -> Result<bool, Error>
pub async fn ensure_image(&self, image: &str) -> Result<bool, Error>
Pull image only when it isn’t already cached. Returns true if a
pull happened, false if the image was already present. Image refs
should be tag-pinned (caddy:2.10-alpine) so this stays deterministic.
Sourcepub async fn build_image(
&self,
tag: &str,
dockerfile: &Path,
context: &Path,
) -> Result<(), Error>
pub async fn build_image( &self, tag: &str, dockerfile: &Path, context: &Path, ) -> Result<(), Error>
Build a local image from a Dockerfile via docker build -t <tag> -f <dockerfile> <context>. Unlike ensure_image
(which pulls a published ref) this compiles the component’s own image
from source — the kind = "container" reconciler path (R602-T1).
dockerfile is the path to the Dockerfile; context is the build
context directory. Both are passed to docker verbatim, so the caller
resolves them to real paths first. Docker’s layer cache makes repeat
builds of an unchanged tree cheap, so callers may build unconditionally
on every reconcile without a separate freshness check.
Sourcepub async fn ensure_network(&self, name: &str) -> Result<bool, Error>
pub async fn ensure_network(&self, name: &str) -> Result<bool, Error>
Idempotently create a docker bridge network. Returns true if a
network was created, false if one already existed under name.
Used by the pond per-cell bridge bring-up (R455-F1).
Sourcepub async fn remove_container(&self, name: &str) -> Result<(), Error>
pub async fn remove_container(&self, name: &str) -> Result<(), Error>
Best-effort docker rm -f <name> — silent when the container is
already gone. Used before run to clear orphans from a prior crash.
Sourcepub async fn run(&self, spec: &ContainerRunSpec) -> Result<(), Error>
pub async fn run(&self, spec: &ContainerRunSpec) -> Result<(), Error>
Start a detached container per spec. Pre-clears any prior container
with the same name so re-runs after a crash are idempotent.
Sourcepub async fn container_host_port(
&self,
name: &str,
container_port: u16,
) -> Result<u16, Error>
pub async fn container_host_port( &self, name: &str, container_port: u16, ) -> Result<u16, Error>
Read the host-side port that the container mapped container_port/tcp
to. Runs docker port <name> <container_port> and parses the output
(0.0.0.0:XXXXX or :::XXXXX). Returns an error when the container is
not running or the port is not published.
Sourcepub async fn container_state(
&self,
name: &str,
) -> Result<Option<ContainerState>, Error>
pub async fn container_state( &self, name: &str, ) -> Result<Option<ContainerState>, Error>
Fetch the container’s State.Status field (running / exited / …).
Returns Ok(None) when the container doesn’t exist.
Sourcepub async fn stop_and_remove(
&self,
name: &str,
grace: Duration,
) -> Result<(), Error>
pub async fn stop_and_remove( &self, name: &str, grace: Duration, ) -> Result<(), Error>
Graceful docker stop -t <grace_seconds> followed by docker rm.
No-op if the container doesn’t exist.
Sourcepub async fn list_owned(&self) -> Result<Vec<OwnedContainer>, Error>
pub async fn list_owned(&self) -> Result<Vec<OwnedContainer>, Error>
List every container owned by this module on this runtime.
Queries both yah.pond (current) and yah.local-sim (legacy, pre-R362)
label keys so old-generation containers are visible during the transition.
Trait Implementations§
Source§impl Clone for LocalRuntime
impl Clone for LocalRuntime
Source§fn clone(&self) -> LocalRuntime
fn clone(&self) -> LocalRuntime
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ContainerLauncher for LocalRuntime
impl ContainerLauncher for LocalRuntime
Source§fn ensure_image<'life0, 'life1, 'async_trait>(
&'life0 self,
image: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalRuntime: 'async_trait,
fn ensure_image<'life0, 'life1, 'async_trait>(
&'life0 self,
image: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalRuntime: 'async_trait,
image unless it is already present. true when a pull happened.Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 ContainerRunSpec,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalRuntime: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 ContainerRunSpec,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalRuntime: 'async_trait,
spec, replacing any prior container of
the same name.Source§fn stop_and_remove<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
grace: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalRuntime: 'async_trait,
fn stop_and_remove<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
grace: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalRuntime: 'async_trait,
grace, then remove. No-op when the container is absent.Auto Trait Implementations§
impl Freeze for LocalRuntime
impl RefUnwindSafe for LocalRuntime
impl Send for LocalRuntime
impl Sync for LocalRuntime
impl Unpin for LocalRuntime
impl UnsafeUnpin for LocalRuntime
impl UnwindSafe for LocalRuntime
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more