Build bounded cellular session batches
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (postgres) (push) Failing after 53s
Foundation / checks (tsan) (push) Failing after 31s
Foundation / checks (network) (push) Failing after 3m1s
Foundation / checks (client) (push) Failing after 4m25s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (postgres) (push) Failing after 53s
Foundation / checks (tsan) (push) Failing after 31s
Foundation / checks (network) (push) Failing after 3m1s
Foundation / checks (client) (push) Failing after 4m25s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
|
||||
#include "evo/network/intent_admission.hpp"
|
||||
#include "evo/server/lifecycle/cellular_batch.hpp"
|
||||
#include "evo/persistence/region_lease.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace evo::server {
|
||||
@@ -14,7 +17,11 @@ enum class CellularSessionBatchError : std::uint8_t {
|
||||
intents,
|
||||
action,
|
||||
life,
|
||||
duplicate_action
|
||||
duplicate_action,
|
||||
head,
|
||||
batch_full,
|
||||
action_limit,
|
||||
biology
|
||||
};
|
||||
|
||||
struct CellularSessionTick {
|
||||
@@ -29,4 +36,28 @@ struct CellularSessionTick {
|
||||
prepare_cellular_session_tick(const CellularLives& state, std::uint64_t tick,
|
||||
std::span<const CellularLifeIntent> baseline,
|
||||
std::span<const network::CarriedAction> actions);
|
||||
|
||||
// Builds one bounded publication from the last durable head. Its working copy is private;
|
||||
// only the host may publish, and callers must discard it after uncertainty until the host
|
||||
// resolves that exact prepared batch.
|
||||
class CellularSessionBatchBuilder {
|
||||
public:
|
||||
[[nodiscard]] static std::expected<CellularSessionBatchBuilder, CellularSessionBatchError>
|
||||
create(const CellularLives& committed_state, const persistence::RegionHead& committed_head);
|
||||
[[nodiscard]] std::expected<void, CellularSessionBatchError>
|
||||
append(std::uint64_t tick, std::span<const CellularLifeIntent> baseline,
|
||||
std::span<const network::CarriedAction> actions);
|
||||
[[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_; }
|
||||
|
||||
private:
|
||||
explicit CellularSessionBatchBuilder(std::unique_ptr<CellularLives> working)
|
||||
: working_{std::move(working)} {}
|
||||
std::unique_ptr<CellularLives> working_;
|
||||
CellularBatch batch_;
|
||||
std::vector<CellularActionRecord> actions_;
|
||||
};
|
||||
} // namespace evo::server
|
||||
|
||||
Reference in New Issue
Block a user