Files
aevolution/include/evo/server/lifecycle/cellular_census_set.hpp
T
dingo dc7c0e1fa1
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 1m13s
Foundation / checks (client) (push) Canceled after 1m14s
Foundation / checks (postgres) (push) Canceled after 1m7s
Foundation / checks (deploy) (push) Canceled after 1m13s
Foundation / checks (ecs) (push) Canceled after 1m13s
Foundation / checks (network) (push) Canceled after 1m14s
feat(ecology): distinguish inherited plans in verified census
2026-10-19 15:06:47 -04:00

57 lines
2.3 KiB
C++

#pragma once
#include "evo/server/lifecycle/cellular_census.hpp"
#include <cstddef>
#include <cstdint>
#include <expected>
#include <span>
#include <vector>
namespace evo::server {
// A query/work bound, not a selected world size or proof of world completeness.
inline constexpr std::size_t max_cellular_census_regions = 64;
struct CellularCensusSetBoundary {
std::uint64_t world{}, frame{}, tick{};
std::uint32_t owner_format{}, rules{};
std::uint64_t quantum_microseconds{biology::cellular_motion_tick_microseconds};
std::uint32_t projection_version{cellular_census_projection_version};
bool operator==(const CellularCensusSetBoundary&) const = default;
};
enum class CellularCensusSetError : std::uint8_t {
invalid_request,
coverage,
boundary,
genome_conflict,
resident_conflict
};
// Detached observations of an explicitly declared region set. No branch,
// commit, permission, ownership or globally complete reconciliation proof.
class CellularCensusSet {
public:
// required_regions must be nonzero, strictly ascending and contain 1..64 IDs.
// Exactly one observation per required region, at the exact common boundary.
// Raw/cohort classification may differ; owner/rules/quantum/projection may not.
[[nodiscard]] static std::expected<CellularCensusSet, CellularCensusSetError>
observe(CellularCensusSetBoundary, std::span<const std::uint64_t> required_regions,
std::span<const CellularCensus> observations);
[[nodiscard]] const CellularCensusSetBoundary& boundary() const noexcept {
return boundary_;
}
// Sorted by region, owning detached copies. Lifetime: this object.
[[nodiscard]] std::span<const CellularCensus> regions() const noexcept {
return regions_;
}
// Unknown everywhere is an error, never absence. An absent local anchor can
// contribute zero only after the complete declared set has been validated.
// Nonresident totals count historical record occurrences, not unique lives.
[[nodiscard]] std::expected<CellularCensusTotals, CellularCensusError>
query(std::uint64_t anchor, CellularCensusScope scope) const;
private:
CellularCensusSet() = default;
CellularCensusSetBoundary boundary_;
std::vector<CellularCensus> regions_;
};
} // namespace evo::server