Add cellular replay trace and recovery lookup
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 41s
Foundation / checks (postgres) (push) Canceled after 0s
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 (client) (push) Canceled after 1m46s
Foundation / checks (network) (push) Canceled after 1m9s
Foundation / checks (ecs) (push) Canceled after 1m38s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 41s
Foundation / checks (postgres) (push) Canceled after 0s
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 (client) (push) Canceled after 1m46s
Foundation / checks (network) (push) Canceled after 1m9s
Foundation / checks (ecs) (push) Canceled after 1m38s
This commit is contained in:
@@ -112,6 +112,13 @@ resolve_cellular_region_commit(Postgres& db, RegionKey key, const Uuid& commit,
|
||||
std::span<const std::uint8_t> decisions,
|
||||
std::span<const std::uint8_t> actions,
|
||||
std::chrono::milliseconds timeout);
|
||||
|
||||
// Load the immutable action block for a committed profile-4 link under the current lease.
|
||||
// Empty means this commit has no cellular publication row; a missing row for a progressing
|
||||
// profile-4 commit is a database error and fails closed.
|
||||
[[nodiscard]] std::expected<std::optional<std::vector<std::uint8_t>>, LeaseStoreFailure>
|
||||
load_cellular_publication_actions(Postgres& db, RegionKey key, const LeaseGrant& lease,
|
||||
const Uuid& commit, std::chrono::milliseconds timeout);
|
||||
// The committed record of an account's action in the lease's world (schema v11), under the
|
||||
// caller's exact lease. Nothing when the action was never committed.
|
||||
struct CommittedAction {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include "evo/server/lifecycle/cellular_lives.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
namespace evo::server {
|
||||
struct CellularBatchHeader {
|
||||
std::uint64_t world{}, region{}, frame{};
|
||||
std::array<std::uint8_t, 16> predecessor{};
|
||||
std::array<std::uint8_t, 32> predecessor_digest{};
|
||||
std::uint64_t begin_tick{}, end_tick{};
|
||||
friend bool operator==(const CellularBatchHeader&, const CellularBatchHeader&) = default;
|
||||
};
|
||||
struct CellularTickIntents {
|
||||
// One intention for each life alive at the start of this tick, sorted by life_id.
|
||||
std::vector<CellularLifeIntent> lives;
|
||||
friend bool operator==(const CellularTickIntents&, const CellularTickIntents&) = default;
|
||||
};
|
||||
struct CellularBatch {
|
||||
CellularBatchHeader header{};
|
||||
std::vector<CellularTickIntents> ticks;
|
||||
friend bool operator==(const CellularBatch&, const CellularBatch&) = default;
|
||||
};
|
||||
|
||||
inline constexpr std::uint32_t cellular_batch_format = 1;
|
||||
inline constexpr std::size_t cellular_batch_header_bytes = 112;
|
||||
inline constexpr std::size_t cellular_batch_tick_header_bytes = 4;
|
||||
inline constexpr std::size_t cellular_batch_intent_bytes = 24;
|
||||
inline constexpr std::size_t max_cellular_batch_ticks = 64;
|
||||
inline constexpr std::size_t max_cellular_batch_bytes = cellular_batch_header_bytes +
|
||||
max_cellular_batch_ticks * (cellular_batch_tick_header_bytes +
|
||||
biology::max_cellular_tick_lives * cellular_batch_intent_bytes);
|
||||
enum class CellularBatchError : std::uint8_t { format, version, scope, state };
|
||||
|
||||
// Canonical replay input: one bounded, life-ID-ordered intention set per tick.
|
||||
[[nodiscard]] std::expected<std::vector<std::uint8_t>, CellularBatchError>
|
||||
encode_cellular_batch(const CellularBatch& batch);
|
||||
[[nodiscard]] std::expected<CellularBatch, CellularBatchError>
|
||||
decode_cellular_batch(std::span<const std::uint8_t> bytes);
|
||||
// Replays from an immutable predecessor snapshot. The caller must first bind the
|
||||
// header identity, predecessor commit/digest and tick range to trusted manifests.
|
||||
// Every tick must cover its living set; the caller compares the returned snapshot.
|
||||
[[nodiscard]] std::expected<std::unique_ptr<CellularLives>, CellularBatchError>
|
||||
replay_cellular_batch(const CellularLives& base, const CellularBatch& batch);
|
||||
} // namespace evo::server
|
||||
Reference in New Issue
Block a user