Skip to main content

StackDef

Struct StackDef 

Source
pub struct StackDef {
    pub name: String,
    pub org: OrgId,
    pub file: ComposeFile,
    pub base_dir: PathBuf,
    pub secrets: BTreeMap<String, SecretBinding>,
    pub force: BTreeMap<String, u64>,
    pub images: BTreeMap<String, String>,
    pub deployed_at: u64,
    pub deployed_by: String,
    pub source: Option<String>,
    pub domains: BTreeMap<String, Vec<DomainSpec>>,
    pub previous: Option<Box<StackDef>>,
}
Expand description

A deployed stack, as the daemon stores it.

Fields§

§name: String§org: OrgId

The org the stack runs in (its incus project).

§file: ComposeFile

The resolved compose file.

§base_dir: PathBuf

Where relative bind paths resolve.

§secrets: BTreeMap<String, SecretBinding>

The secrets the services use, by top-level key: references into the org’s store by name and version, never values (secrets).

§force: BTreeMap<String, u64>

Bumped per service by a forced update, to replace instances whose spec did not change (a moved image tag, say).

§images: BTreeMap<String, String>

The digest each registry: image resolved to at deploy time, by service: a moved tag is a new revision, and a rollback runs exactly what ran before.

§deployed_at: u64

Unix seconds.

§deployed_by: String

Who deployed it (an Access identity, or local).

§source: Option<String>

The compose file as written (${VAR} unresolved), when it was deployed as text and needed no variables from the caller: what stack_export hands out. file is what it resolved to.

§domains: BTreeMap<String, Vec<DomainSpec>>

The stack’s managed domains merged into file (source), per service, so a rollback puts them back too.

§previous: Option<Box<StackDef>>

The deployment this one replaced, for rollback.

Implementations§

Source§

impl StackDef

Source

pub fn qualified(&self) -> String

Source

pub fn revision(&self, service: &str) -> Result<String>

The service’s revision: a hash of what shapes its instances. Replica count, rollout settings and dependencies are left out, so changing them never replaces an instance. A secret counts by its binding (store name, driver, version), so a new version is a new revision, unless its on_change for the service is restart or none: then the version is left out, and a new one is delivered to the running replicas instead (StackDef::live_secrets).

Source

pub fn on_change(&self, service: &str, key: &str) -> OnChange

What a new version of the top-level secret key does to service: the service’s own references first, then the secret’s on_change, then roll.

Source

pub fn live_secrets(&self, service: &str) -> BTreeMap<String, (OnChange, u64)>

The secrets service uses whose new versions reach its running replicas in place (on_change: restart or none), with the setting and the version bound now.

Source

pub fn services_using(&self, key: &str) -> Vec<String>

The services using the top-level secret key.

Source

pub fn store_secrets(&self) -> BTreeSet<String>

Names in the org’s store that the stack’s services use (external ones, and the <stack>_<key> ones it owns): what isb secret rm must not pull out from under it.

Source

pub fn instance_image(&self, service: &str, image: &str) -> String

A service’s image as its instances get it: a registry: tag pinned to the digest it named at deploy time (StackDef::images).

Source

pub fn service(&self, service: &str) -> Result<&SandboxSpec>

Trait Implementations§

Source§

impl Clone for StackDef

Source§

fn clone(&self) -> Self

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 StackDef

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StackDef

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for StackDef

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V