Skip to main content

CloudConfig

Struct CloudConfig 

Source
pub struct CloudConfig {
    pub workspace_root: PathBuf,
    pub machines: Vec<MachineConfig>,
    pub providers: Vec<ProviderConfig>,
    pub machine_origins: BTreeMap<String, InfraOrigin>,
    pub provider_origins: BTreeMap<String, InfraOrigin>,
    pub services: BTreeMap<String, ServiceWithMirrors>,
    pub domains: BTreeMap<String, DomainConfig>,
    pub legacy_mirrors: Vec<LegacyMirrorConfig>,
    pub workloads: Vec<WorkloadConfig>,
    pub topology: TopologyConfig,
    pub legacy_services: Vec<LegacyServiceConfig>,
}
Expand description

All cloud config loaded from a workspace root (the parent of .yah/).

Reads two trees:

  • .yah/infra/ — machines/, providers/
  • .yah/services/<svc>/ — service.toml + mirrors/<env>.toml

Pre-R215 fields (legacy_mirrors, legacy_services, workloads, topology) are still populated from .yah/cloud/ when present so pre-R215 callers (compose.rs, bucket commands) keep compiling — they just see empty collections in a post-B1 workspace where the legacy data was deleted. These fields are scheduled for removal in B3-T3.

Fields§

§workspace_root: PathBuf

Workspace root that was loaded — useful for path-resolving component references on a ServiceComponent.

§machines: Vec<MachineConfig>

.yah/infra/machines/<name>.toml

§providers: Vec<ProviderConfig>

.yah/infra/providers/<id>.toml

§machine_origins: BTreeMap<String, InfraOrigin>

Provenance for every entry in machines that came from a linked .yah/infra/sources.toml source rather than this camp’s own .yah/infra/machines/ (R615-F2 / W274). Keyed by MachineConfig::name; a name absent here is camp-local. Empty from CloudConfig::load_from_config_dir — see its doc for why sources don’t apply to multi-root sibling trees.

§provider_origins: BTreeMap<String, InfraOrigin>§services: BTreeMap<String, ServiceWithMirrors>

.yah/services/<svc>/ — service.toml plus mirrors/.toml.

§domains: BTreeMap<String, DomainConfig>

.yah/domains/<name>.toml — public-facing routing manifests (R347). Single file per domain; no nested per-env tree because domains themselves aren’t projected onto infra — they describe how a Worker bundle ingresses requests onto services.

§legacy_mirrors: Vec<LegacyMirrorConfig>

Legacy mirrors from .yah/cloud/mirrors/.

§workloads: Vec<WorkloadConfig>

Workloads from .yah/cloud/workloads/*.toml (R092-F1 schema).

§topology: TopologyConfig

Topology from .yah/cloud/topology.toml (mirror→machine assignments).

§legacy_services: Vec<LegacyServiceConfig>

Legacy services from .yah/cloud/services/*.toml (pre-R092 layout).

Implementations§

Source§

impl CloudConfig

Source

pub fn load(workspace_root: &Path) -> Result<Self>

Load all cloud config rooted at workspace_root (the parent of .yah/).

Reads the R215+ tree (.yah/infra/, .yah/services/<svc>/) eagerly and the pre-R215 .yah/cloud/ tree opportunistically. Returns Err immediately if any TOML fails to parse or a workload TOML fails shape validation; the error includes the file path and field path.

Cross-ref validation runs after both trees finish loading: every mirror.providers.X.use = "<id>" must resolve to a real provider declared under .yah/infra/providers/.

Source

pub fn load_from_config_dir( config_dir: &Path, workspace_root: &Path, ) -> Result<Self>

Load the R215+ tree (infra/, services/, domains/) rooted at an arbitrary config directory instead of the hardcoded .yah/. This is the building block for multi-root deployments (W206 config layout (b), sibling .noisetable/ trees) — see crate::multi_root. Part of R558-F4.

config_dir is the .X/ directory itself (e.g. <parent>/.noisetable); workspace_root remains the camp dir (the config dir’s parent) so a component’s path reference resolves against the same tree the classic CloudConfig::load uses. The legacy .yah/cloud/ reads are skipped — multi-root deployments are post-R215 by construction — so legacy_*, workloads, and topology come back empty. Machines are read from config_dir/infra/machines directly (sibling trees declare their own inventory or none).

R615-F2 decision, explicit rather than silent: sources.toml overlay does NOT apply here. This function exists specifically because a multi-root sibling tree (W206 layout (b), e.g. .noisetable/) is a second config root inside the same camp, not a second camp — config_dir is already wherever the caller decided this tree’s infra lives, and .yah/infra/sources.toml (singular, tied to paths::infra_dir(workspace_root)) has no well-defined meaning for an arbitrary config_dir that isn’t that path. A sibling tree that wants borrowed infra declares its own sources.toml under whichever root actually calls CloudConfig::load for it; machine_origins/provider_origins come back empty here, not wrong — there is nothing to overlay.

Source

pub fn domain(&self, name: &str) -> Option<&DomainConfig>

Look up a domain manifest by name (file stem under .yah/domains/).

Source

pub fn machine(&self, name: &str) -> Option<&MachineConfig>

Source

pub fn provider(&self, id: &str) -> Option<&ProviderConfig>

Look up a provider by id (matches provider.id, not the file stem).

Source

pub fn service(&self, name: &str) -> Option<&ServiceWithMirrors>

Look up a service by name (matches service.toml’s name field).

Source

pub fn legacy_mirror(&self, camp: &str) -> Option<&LegacyMirrorConfig>

Look up a legacy mirror by camp name (pre-R215 .yah/cloud/mirrors/).

Source

pub fn workload(&self, name: &str) -> Option<&WorkloadConfig>

Source

pub fn resolve_machine(&self, req: &RequiredSpec) -> Result<&MachineConfig>

F16 placement v1: the first machine satisfying every hard axis of req (region/zone/provider membership + mesh_tags superset). Declaration order in .yah/infra/machines/ decides ties — deterministic-greedy, no backtracking. A fully-unconstrained req matches the first machine.

Fails loud with the constraint summary and the candidate machine names when nothing matches, so yah cloud apply surfaces why placement failed instead of a silent empty set.

Source

pub fn resolve_machine_by_mesh_tags( &self, required: &[String], ) -> Option<&MachineConfig>

F16 placement: first machine whose mesh_tags is a superset of required. Declaration order in .yah/infra/machines/ decides ties. Empty required matches the first machine; callers should treat empty-required as “no constraint” and skip this lookup.

Back-compat thin wrapper over CloudConfig::resolve_machine for the mesh-tags-only call sites that predate the topology axes.

Source

pub fn admit_workload(&self, ws: &WorkloadSpec) -> Result<&MachineConfig>

Admission: resolve the target machine for a remote WorkloadSpec, honoring the R594 mesh-tag node-selector annotation (velveteen_exec::remote::NODE_SELECTOR_MESH_TAGS_ANNOTATION = yah.node-selector.mesh-tags, comma-joined).

The producer side (velveteen_exec::remote::build_workload_spec, R594) writes TaskLocation::RemoteAny.mesh_tags — e.g. [tag:build-worker, tier:x86] from [qed::platform::build_worker_mesh_tags] — into the workload’s annotations. This is the consumer: candidates are restricted to machines whose mesh_tags are a superset of the requested set, so an amd64 build lands on the tier:x86 build-worker (us-west-002) and an arm64 build on a tier:arm Pi5. Declaration order in .yah/infra/machines/ breaks ties.

An absent or empty annotation means “no mesh-tag constraint” — pre-R594 behavior (any node), matching RequiredSpec::is_unconstrained.

This is the single admission seam: R572-F5 extends it with the capacity floor (workload request fits node allocatable−committed) and repel-unless-tolerate taints by enriching RequiredSpec::matches / Self::resolve_machine. Do not fork a second selector.

Trait Implementations§

Source§

impl Debug for CloudConfig

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Fruit for T
where T: Send + Downcast,

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more