#pragma once #include #include #include #include #include // ADR-0182 section 15: the admin portal opens a fresh region in place of the one DEV serves. // The change is four Git files edited in place: the region overlay's values (world, region, // life routes, the opening's genesis commit and seeded wildlife range, both for the region // Deployment and its provision Job), its kustomization header, and the region named by the // grant broker's routes and the admin portal. Anything else is left exactly as it is; a file // whose layout differs from the expected lines is refused rather than guessed at. namespace evo::server::admin { inline constexpr std::array region_switch_paths{ "deploy/kubernetes/region/dev/region-values.yaml", "deploy/kubernetes/region/dev/kustomization.yaml", "deploy/kubernetes/grant-broker-dev/deployment.yaml", "deploy/kubernetes/admin-portal-dev/deployment.yaml", }; // The four files' text, in region_switch_paths order. using RegionSwitchFiles = std::array; // What the files say DEV serves: the world and region, the opening's genesis commit (32 // lowercase hex digits) and the first seeded wildlife identity. struct RegionLayout { std::uint64_t world{}, region{}; std::string commit; std::uint64_t wildlife_first{}; auto operator<=>(const RegionLayout&) const = default; }; // The served layout, or the name of the line that is missing, repeated or inconsistent. [[nodiscard]] std::expected read_region_layout(const RegionSwitchFiles& files); // The files serving `to` (same world) instead, with `note` (one line, no line breaks) recorded // as a comment above the opening; or why the files or `to` cannot be switched. [[nodiscard]] std::expected switch_region(const RegionSwitchFiles& files, const RegionLayout& to, std::string_view note); } // namespace evo::server::admin