Files
aevolution/include/evo/persistence/cellular_history_store.hpp
T
dingo a180c41ae7
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 2m25s
Foundation / checks (network) (push) Successful in 20m50s
Foundation / checks (client) (push) Successful in 22m7s
Foundation / checks (tsan) (push) Successful in 24m42s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 35m33s
Foundation / checks (checks) (push) Canceled after 35m43s
M12.6: derive replayed census history from immutable commits
2026-10-18 14:36:14 -04:00

44 lines
2.0 KiB
C++

#pragma once
#include "evo/persistence/population_checkpoint_store.hpp"
#include "evo/server/lifecycle/cellular_census.hpp"
#include <cstddef>
#include <cstdint>
#include <expected>
#include <optional>
#include <span>
#include <vector>
namespace evo::persistence {
inline constexpr std::size_t max_cellular_history_page = 8;
struct CellularCensusHistoryEntry {
CommittedCheckpoint committed;
server::CellularCensus census;
};
struct CellularCensusHistoryPage {
RegionKey key{};
RegionHead watermark{}; // Exact immutable regional upper cut, not world coverage.
std::vector<CellularCensusHistoryEntry> entries;
std::optional<std::uint64_t> next_sequence;
};
enum class CellularHistoryError : std::uint8_t { invalid_request, cut_mismatch, recovery };
struct CellularHistoryFailure {
CellularHistoryError kind{};
RecoveryFailure recovery{}; // Meaningful only for recovery.
};
// Read-only forward history from the existing atomic biological commit journal.
// Inclusive first_sequence, at most eight consecutive commits, pinned upper cut.
// Full historical replay precedes every census. Any missing/unsupported/false
// evidence fails the ENTIRE page; there is no zero/skip/older-head fallback.
// Requires an idle connection: caller-owned transactions (including read-only
// transactions) are refused so pending writer changes cannot appear durable.
// Current grant is used by existing fenced evidence readers; output confers no
// live authority, recovery-branch identity or world completeness. Per-I/O timeout.
[[nodiscard]] std::expected<CellularCensusHistoryPage, CellularHistoryFailure>
load_cellular_census_history(Postgres&, const FilesystemObjectStore&, RegionKey, const LeaseGrant&,
const RegionHead& watermark, std::uint64_t first_sequence,
std::size_t limit, std::span<const Sha256Digest> retained_builds,
std::chrono::milliseconds timeout);
} // namespace evo::persistence