Skip to main content

DockerServiceConfig

Trait DockerServiceConfig 

Source
pub trait DockerServiceConfig: Send + 'static {
    // Required methods
    fn id(&self) -> String;
    fn is_user_managed(&self) -> bool;
    fn image(&self) -> String;

    // Provided methods
    fn args(&self) -> Vec<String> { ... }
    fn envs(&self) -> Vec<(String, String)> { ... }
    fn ports(&self) -> Vec<(String, String)> { ... }
    fn data_path(&self) -> Option<String> { ... }
    fn latency_ms(&self) -> u32 { ... }
}
Expand description

Configuration for a docker-backed service.

The trait can be implemented for the configuration struct of a service. After that, use DockerService<Config> as the service type.

Required Methods§

Source

fn id(&self) -> String

The unique identifier of the service.

Source

fn is_user_managed(&self) -> bool

Whether the service is managed by the user.

If true, no docker container will be started and the service will be forwarded to the DummyService.

Source

fn image(&self) -> String

The docker image to use, e.g. mysql:5.7.

Provided Methods§

Source

fn args(&self) -> Vec<String>

Additional arguments to pass to the docker container.

Source

fn envs(&self) -> Vec<(String, String)>

The environment variables to pass to the docker container.

Source

fn ports(&self) -> Vec<(String, String)>

The ports to expose on the host, e.g. ("0.0.0.0:23306", "3306").

The first element of the tuple is the host port (or address), the second is the container port.

Source

fn data_path(&self) -> Option<String>

The path in the container to persist data to, e.g. /var/lib/mysql.

Some if the service is specified to persist data, None otherwise.

Source

fn latency_ms(&self) -> u32

Network latency in milliseconds to add to the container.

Some if latency should be added, None otherwise.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§