Skip to main content

ContainerLauncher

Trait ContainerLauncher 

Source
pub trait ContainerLauncher: Send + Sync {
    // Required methods
    fn ensure_image<'life0, 'life1, 'async_trait>(
        &'life0 self,
        image: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 self,
        spec: &'life1 ContainerRunSpec,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn stop_and_remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        grace: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

The three container operations the pond bring-up sequences need, factored out of LocalRuntime so a caller can supply a different launcher.

The pond ensure_*_running functions are choreography — write the state dir, pull, run, wait for the port, wait for HTTP ready, apply post-start config (MinIO’s bucket policy). None of that is docker-CLI-specific; only the three verbs below are. Splitting them lets yubaba route the same choreography through kamaji (so dockerd owns restart, R626) while the cloud tier keeps driving LocalRuntime directly and unchanged.

A launcher is expected to be idempotent: run against an existing container of the same name replaces it, and stop_and_remove on a missing container succeeds.

Required Methods§

Source

fn ensure_image<'life0, 'life1, 'async_trait>( &'life0 self, image: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Pull 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<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Start a detached container per 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<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stop with grace, then remove. No-op when the container is absent.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: ContainerLauncher + ?Sized> ContainerLauncher for Arc<T>

Pond holds its runtimes as Arc<…> and the ensure_*_running functions are generic, so &Arc<T> needs its own impl — generic parameters don’t auto-deref the way &LocalRuntime did.

Source§

fn ensure_image<'life0, 'life1, 'async_trait>( &'life0 self, image: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn run<'life0, 'life1, 'async_trait>( &'life0 self, spec: &'life1 ContainerRunSpec, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn stop_and_remove<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, grace: Duration, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§