Skip to main content

ComposeEngine

Trait ComposeEngine 

Source
pub trait ComposeEngine: Send + Sync {
    // Required methods
    fn up<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        dir: &'life1 Path,
        opts: &'life2 UpOptions,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn down<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        dir: &'life1 Path,
        opts: &'life2 DownOptions,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn ls<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ProjectStatus>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn ps<'life0, 'life1, 'async_trait>(
        &'life0 self,
        project: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceStatus>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn logs<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        project: &'life1 str,
        opts: &'life2 LogOptions,
    ) -> Pin<Box<dyn Future<Output = Result<EngineStream<LogLine>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn events<'life0, 'life1, 'async_trait>(
        &'life0 self,
        filter: &'life1 EventFilter,
    ) -> Pin<Box<dyn Future<Output = Result<EngineStream<EngineEvent>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn network_rm<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Docker Compose, as the runtime drives it. DockerCli runs the real CLI; FakeEngine (feature testing) is an in-memory stand-in.

A project is addressed by the directory holding its head compose.yaml for the commands that read its files (up, down), and by its name for the ones Docker answers from its labels (ps, logs).

Required Methods§

Source

fn up<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, opts: &'life2 UpOptions, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create and start the project in dir (docker compose up -d).

Source

fn down<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, opts: &'life2 DownOptions, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stop and remove the project in dir (docker compose down).

Source

fn ls<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ProjectStatus>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Every project Docker knows of, running or stopped (docker compose ls --all).

Source

fn ps<'life0, 'life1, 'async_trait>( &'life0 self, project: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceStatus>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The containers of project, running or stopped (docker compose ps --all).

Source

fn logs<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, project: &'life1 str, opts: &'life2 LogOptions, ) -> Pin<Box<dyn Future<Output = Result<EngineStream<LogLine>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The log lines of project’s containers (docker compose logs --timestamps).

Source

fn events<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 EventFilter, ) -> Pin<Box<dyn Future<Output = Result<EngineStream<EngineEvent>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Container events of the projects filter picks, from now on (docker events).

Source

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

Remove the network name; Ok(false) when it doesn’t exist or is still in use.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl ComposeEngine for DockerCli

Source§

impl ComposeEngine for FakeEngine

Available on crate feature testing only.