M12.3: publish and recover durable exact populations
Foundation / checks (ecs) (push) Successful in 2m41s
Foundation / checks (tsan) (push) Failing after 18m12s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (network) (push) Canceled after 20m41s
Foundation / checks (postgres) (push) Canceled after 20m43s
Foundation / checks (checks) (push) Canceled after 20m49s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (client) (push) Failing after 17m4s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / checks (ecs) (push) Successful in 2m41s
Foundation / checks (tsan) (push) Failing after 18m12s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (network) (push) Canceled after 20m41s
Foundation / checks (postgres) (push) Canceled after 20m43s
Foundation / checks (checks) (push) Canceled after 20m49s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (client) (push) Failing after 17m4s
Foundation / postgres-tools (push) Canceled after 0s
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <vector>
|
||||
|
||||
namespace evo::server {
|
||||
struct CellularPopulationBatch;
|
||||
// ADR-0139: exact local cohorts retain individuals, never mean reserves or samples.
|
||||
// The single owned CellularLives store backs BOTH representations, exactly once.
|
||||
struct CellularCohortMember {
|
||||
@@ -72,6 +73,8 @@ class CellularPopulation {
|
||||
std::span<const CellularMutationSelection> selections = {});
|
||||
|
||||
private:
|
||||
friend std::expected<std::unique_ptr<CellularPopulation>, CellularPopulationError>
|
||||
execute_population_batch(const CellularPopulation&, CellularPopulationBatch&, bool);
|
||||
explicit CellularPopulation(std::unique_ptr<CellularLives> state, CellularTierPolicy policy);
|
||||
void apply_policy();
|
||||
std::unique_ptr<CellularLives> state_;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include "evo/server/lifecycle/cellular_batch.hpp"
|
||||
#include "evo/server/lifecycle/cellular_population.hpp"
|
||||
|
||||
namespace evo::server {
|
||||
struct CellularPopulationBoundary {
|
||||
std::uint64_t sequence{};
|
||||
std::vector<CellularCohortMember> members;
|
||||
bool operator==(const CellularPopulationBoundary&) const = default;
|
||||
};
|
||||
struct CellularPopulationConversion {
|
||||
std::uint64_t genome{};
|
||||
bool to_cohort{};
|
||||
bool operator==(const CellularPopulationConversion&) const = default;
|
||||
};
|
||||
struct CellularPopulationBatch {
|
||||
CellularBatchHeader header;
|
||||
// Exactly one: 1..64 unattended biological ticks, or a no-tick whole-group conversion.
|
||||
CellularBatch biology;
|
||||
std::optional<CellularPopulationConversion> conversion;
|
||||
std::vector<CellularPopulationBoundary> boundaries;
|
||||
bool operator==(const CellularPopulationBatch&) const = default;
|
||||
};
|
||||
inline constexpr std::size_t population_batch_header_bytes = 136;
|
||||
inline constexpr std::size_t max_population_batch_bytes =
|
||||
population_batch_header_bytes + max_cellular_batch_bytes +
|
||||
max_cellular_batch_ticks * (16 + 16 * biology::max_cellular_tick_lives);
|
||||
struct CellularPopulationExecution {
|
||||
CellularPopulationBatch batch;
|
||||
std::unique_ptr<CellularPopulation> state;
|
||||
};
|
||||
// Build an unattended interval from a detached biological copy. Controlled cells
|
||||
// receive frozen-only intentions; the unchanged wildlife controller supplies the
|
||||
// rest. The returned recorded intentions replay without rerunning that controller.
|
||||
[[nodiscard]] std::expected<CellularBatch, CellularPopulationError>
|
||||
unattended_population_inputs(const CellularLives&, const CellularBatchHeader&);
|
||||
[[nodiscard]] std::expected<CellularPopulationExecution, CellularPopulationError>
|
||||
prepare_population_batch(const CellularPopulation& base, CellularBatch biology);
|
||||
[[nodiscard]] std::expected<CellularPopulationExecution, CellularPopulationError>
|
||||
prepare_population_conversion(const CellularPopulation& base, CellularBatchHeader header,
|
||||
CellularPopulationConversion conversion);
|
||||
[[nodiscard]] std::expected<std::unique_ptr<CellularPopulation>, CellularPopulationError>
|
||||
replay_population_batch(const CellularPopulation& base, const CellularPopulationBatch& batch);
|
||||
[[nodiscard]] std::expected<std::vector<std::uint8_t>, CellularPopulationError>
|
||||
encode_population_batch(const CellularPopulationBatch& batch);
|
||||
[[nodiscard]] std::expected<CellularPopulationBatch, CellularPopulationError>
|
||||
decode_population_batch(std::span<const std::uint8_t> bytes);
|
||||
} // namespace evo::server
|
||||
Reference in New Issue
Block a user