Skip to main content

LocalRuntime

Struct LocalRuntime 

Source
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: String

DOCKER_HOST value used for every docker CLI invocation against this runtime (e.g. "unix:///…" or "tcp://localhost:2375").

Implementations§

Source§

impl LocalRuntime

Source

pub async fn detect(spec: &LocalContainerSpec) -> Result<Self>

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.

Source

pub async fn has_image(&self, image: &str) -> Result<bool>

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.

Source

pub async fn ensure_image(&self, image: &str) -> Result<bool>

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.

Source

pub async fn ensure_network(&self, name: &str) -> Result<bool>

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).

Source

pub async fn remove_container(&self, name: &str) -> Result<()>

Best-effort docker rm -f <name> — silent when the container is already gone. Used before run to clear orphans from a prior crash.

Source

pub async fn run(&self, spec: &ContainerRunSpec) -> Result<()>

Start a detached container per spec. Pre-clears any prior container with the same name so re-runs after a crash are idempotent.

Source

pub async fn container_host_port( &self, name: &str, container_port: u16, ) -> Result<u16>

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.

Source

pub async fn container_state( &self, name: &str, ) -> Result<Option<ContainerState>>

Fetch the container’s State.Status field (running / exited / …). Returns Ok(None) when the container doesn’t exist.

Source

pub async fn stop_and_remove(&self, name: &str, grace: Duration) -> Result<()>

Graceful docker stop -t <grace_seconds> followed by docker rm. No-op if the container doesn’t exist.

Source

pub async fn list_owned(&self) -> Result<Vec<OwnedContainer>>

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

Source§

fn clone(&self) -> LocalRuntime

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LocalRuntime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more