pub struct ServiceConfig<'a> {
    pub image: String,
    pub args: &'a (dyn Fn(&ServiceAssignments<'_>) -> Vec<String> + Send + Sync),
    pub ports: Vec<ServicePort>,
    pub memory_limit: Option<MemoryLimit>,
    pub cpu_limit: Option<CpuLimit>,
    pub scale: NonZeroUsize,
    pub labels: HashMap<String, String>,
    pub availability_zone: Option<String>,
}
Expand description

Describes the desired state of a service.

Fields

image: String

An opaque identifier for the executable or container image to run.

Often names a container on Docker Hub or a path on the local machine.

args: &'a (dyn Fn(&ServiceAssignments<'_>) -> Vec<String> + Send + Sync)

A function that generates the arguments for each process of the service given the assignments that the orchestrator has made.

ports: Vec<ServicePort>

Ports to expose.

memory_limit: Option<MemoryLimit>

An optional limit on the memory that the service can use.

cpu_limit: Option<CpuLimit>

An optional limit on the CPU that the service can use.

scale: NonZeroUsize

The number of copies of this service to run.

labels: HashMap<String, String>

Arbitrary key–value pairs to attach to the service in the orchestrator backend.

The orchestrator backend may apply a prefix to the key if appropriate.

availability_zone: Option<String>

The availability zone the service should be run in. If no availability zone is specified, the orchestrator is free to choose one.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.