Skip to main content

greentic_deploy_spec/
runtime_config.rs

1//! `greentic.runtime-config.v1` (`ยง5.7`).
2//!
3//! Materialized by the operator from `Environment` + active `Revision`s +
4//! `TrafficSplit`s. Each runtime-config carries one
5//! [`RevisionRuntimeBlock`](RevisionRuntimeBlock) per ready revision across all
6//! deployments in the env.
7
8use crate::ids::{BundleId, DeploymentId, RevisionId};
9use crate::version::SchemaVersion;
10use greentic_types::EnvId;
11use serde::{Deserialize, Serialize};
12use std::path::PathBuf;
13
14#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
15pub struct RevisionRuntimeBlock {
16    pub deployment_id: DeploymentId,
17    pub revision_id: RevisionId,
18    pub bundle_id: BundleId,
19    /// Env-relative paths to pinned per-pack lockfiles.
20    #[serde(default)]
21    pub pack_list_refs: Vec<PathBuf>,
22    /// Env-relative paths to `pack-config.v1` documents per pack.
23    #[serde(default)]
24    pub pack_config_refs: Vec<PathBuf>,
25    pub weight_bps: u32,
26}
27
28#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
29pub struct RuntimeConfig {
30    pub schema: SchemaVersion,
31    pub env_id: EnvId,
32    pub revisions: Vec<RevisionRuntimeBlock>,
33}
34
35impl RuntimeConfig {
36    pub fn schema_str() -> &'static str {
37        SchemaVersion::RUNTIME_CONFIG_V1
38    }
39}