#pragma once #include "evo/persistence/population_checkpoint_store.hpp" namespace evo::persistence { // ADR-0174 / schema 56. Prepared joint commits reuse the population shape: an empty // trace is the no-tick profile 5 -> 6 transition, otherwise a joint batch. struct RecoveredEnvironmentCheckpoint { CommittedCheckpoint committed; CheckpointManifest manifest; std::unique_ptr state; }; // Explicit, one-way and no-tick: wraps the identical committed population with its // declared environment under the same lease/head fence. No biology advances. [[nodiscard]] std::expected migrate_population_to_environment(Postgres&, const FilesystemObjectStore&, const LeaseGrant&, const CommittedCheckpoint& predecessor, Uuid commit, const Sha256Digest& build, server::CellularEnvironmentConfig, std::chrono::milliseconds timeout, const PublishHooks& hooks = {}); // A joint interval (after an owned admission) or whole-group conversion. The batch is // replayed from the committed predecessor and must reproduce `candidate` exactly. [[nodiscard]] std::expected publish_environment_batch(Postgres&, const FilesystemObjectStore&, const LeaseGrant&, const CommittedCheckpoint& predecessor, const server::CellularEnvironmentBatch& batch, const server::CellularEnvironment& candidate, Uuid commit, const Sha256Digest& build, std::chrono::milliseconds timeout, const PublishHooks& hooks = {}); [[nodiscard]] std::expected retry_environment_prepared(Postgres&, const PopulationPreparedCommit&, std::chrono::milliseconds timeout); [[nodiscard]] std::expected resolve_environment_prepared(Postgres&, const PopulationPreparedCommit&, std::chrono::milliseconds timeout); // Loads the head, requires its complete evidence and replays its link exactly. [[nodiscard]] std::expected recover_environment_checkpoint(Postgres&, const FilesystemObjectStore&, RegionKey, const LeaseGrant&, std::span retained_builds, std::chrono::milliseconds timeout); } // namespace evo::persistence