Format M11 cellular code with clang-format 19
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m52s
Foundation / checks (client) (push) Failing after 4m25s
Foundation / checks (network) (push) Failing after 3m2s
Foundation / checks (tsan) (push) Failing after 33s
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 5m47s
Foundation / checks (postgres) (push) Canceled after 1m24s

This commit is contained in:
dingo
2026-10-11 02:59:41 -04:00
parent b8a1288ee9
commit c81c1bfc56
25 changed files with 371 additions and 356 deletions
+20 -12
View File
@@ -1,8 +1,8 @@
#pragma once
#include "evo/network/session_protocol.hpp"
#include "evo/persistence/checkpoint_store.hpp"
#include "evo/persistence/life_reservation_store.hpp"
#include "evo/network/session_protocol.hpp"
#include "evo/server/lifecycle/cellular_batch.hpp"
#include "evo/server/ops.hpp"
@@ -25,7 +25,12 @@ struct CellularHostConfig {
persistence::Sha256Digest build{};
std::vector<persistence::Sha256Digest> retained_builds;
};
enum class CellularHostError : std::uint8_t { configuration, not_ready, invalid_batch, publication };
enum class CellularHostError : std::uint8_t {
configuration,
not_ready,
invalid_batch,
publication
};
struct FinalCellularAction {
CellularActionRecord action;
std::uint64_t commit_sequence{};
@@ -36,8 +41,7 @@ struct FinalCellularAction {
// the host replays it from its recovered state and advances only on a confirmed head.
class CellularRegionHost {
public:
[[nodiscard]] static std::expected<std::unique_ptr<CellularRegionHost>,
CellularHostError>
[[nodiscard]] static std::expected<std::unique_ptr<CellularRegionHost>, CellularHostError>
create(CellularHostConfig config, CellularConnect connect,
std::unique_ptr<persistence::FilesystemObjectStore> objects);
CellularRegionHost(const CellularRegionHost&) = delete;
@@ -47,8 +51,7 @@ class CellularRegionHost {
// Acquires/renews authority, recovers fully, or resolves the exact pending commit.
const HostStatus& step();
[[nodiscard]] std::expected<persistence::PublishedCellularBatch, CellularHostError>
publish(const CellularBatch& batch,
std::span<const CellularActionRecord> actions = {});
publish(const CellularBatch& batch, std::span<const CellularActionRecord> actions = {});
// v5 requests allocate durably, then wait for the scheduler to include the exact
// reservation in a profile-4 batch. Repeating the request is idempotent.
[[nodiscard]] network::PrimitiveLifeOutcome
@@ -63,9 +66,14 @@ class CellularRegionHost {
[[nodiscard]] std::vector<FinalCellularAction> take_finalized_actions();
void drain();
[[nodiscard]] std::optional<persistence::LeaseGrant> authority() const;
[[nodiscard]] const HostStatus& status() const noexcept { return status_; }
[[nodiscard]] const CellularLives* state() const noexcept { return state_.get(); }
[[nodiscard]] const std::optional<persistence::CommittedCheckpoint>& committed() const noexcept {
[[nodiscard]] const HostStatus& status() const noexcept {
return status_;
}
[[nodiscard]] const CellularLives* state() const noexcept {
return state_.get();
}
[[nodiscard]] const std::optional<persistence::CommittedCheckpoint>&
committed() const noexcept {
return committed_;
}
@@ -80,9 +88,9 @@ class CellularRegionHost {
void refresh();
void finalize_births(std::span<const CellularTickIntents::Birth> births);
void queue_birth(const CellularTickIntents::Birth& birth);
[[nodiscard]] network::PrimitiveLifeOutcome query_birth(
const persistence::Uuid& account, std::uint64_t generation, std::uint64_t request,
bool enqueue);
[[nodiscard]] network::PrimitiveLifeOutcome query_birth(const persistence::Uuid& account,
std::uint64_t generation,
std::uint64_t request, bool enqueue);
CellularHostConfig config_;
CellularConnect connect_;
@@ -1,8 +1,8 @@
#pragma once
#include "evo/network/intent_admission.hpp"
#include "evo/server/lifecycle/cellular_batch.hpp"
#include "evo/persistence/region_lease.hpp"
#include "evo/server/lifecycle/cellular_batch.hpp"
#include <cstdint>
#include <expected>
@@ -51,11 +51,15 @@ class CellularSessionBatchBuilder {
append(std::uint64_t tick, std::span<const CellularLifeIntent> baseline,
std::span<const network::CarriedAction> actions,
std::span<const CellularTickIntents::Birth> births = {});
[[nodiscard]] const CellularBatch& batch() const noexcept { return batch_; }
[[nodiscard]] const CellularBatch& batch() const noexcept {
return batch_;
}
[[nodiscard]] std::span<const CellularActionRecord> actions() const noexcept {
return actions_;
}
[[nodiscard]] const CellularLives& candidate() const noexcept { return *working_; }
[[nodiscard]] const CellularLives& candidate() const noexcept {
return *working_;
}
private:
explicit CellularSessionBatchBuilder(std::unique_ptr<CellularLives> working)
@@ -50,10 +50,11 @@ inline constexpr std::size_t cellular_batch_tick_header_bytes = 8;
inline constexpr std::size_t cellular_batch_intent_bytes = 24;
inline constexpr std::size_t cellular_batch_birth_bytes = 40;
inline constexpr std::size_t max_cellular_batch_ticks = 64;
inline constexpr std::size_t max_cellular_batch_bytes = cellular_batch_header_bytes +
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 + cellular_batch_birth_bytes));
biology::max_cellular_tick_lives *
(cellular_batch_intent_bytes + cellular_batch_birth_bytes));
enum class CellularBatchError : std::uint8_t { format, version, scope, state };
inline constexpr std::size_t cellular_action_record_bytes = 48;
inline constexpr std::size_t max_cellular_action_records = 1'024;