Add M10.4a intentions, actions and admission
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m45s
Foundation / checks (network) (push) Successful in 9m37s
Foundation / checks (client) (push) Successful in 12m14s
Foundation / checks (tsan) (push) Successful in 7m39s
Foundation / checks (checks) (push) Successful in 31m15s
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 32m59s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m45s
Foundation / checks (network) (push) Successful in 9m37s
Foundation / checks (client) (push) Successful in 12m14s
Foundation / checks (tsan) (push) Successful in 7m39s
Foundation / checks (checks) (push) Successful in 31m15s
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 32m59s
Session protocol v1 (not yet deployed, amended in place) gains realtime intentions on datagrams with receipts and a cumulative simulated watermark, and account-scoped actions with stable ids, receipts, final outcomes and queries. IntentAdmission enforces session binding, rate, authority, epoch, vector, sequence, tick window, duplicates and the unresolved bound; RegionSessions and the client carry it over QUIC. Intentions and actions have no biological effect yet. ADR-0092. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "evo/network/intent_admission.hpp"
|
||||
#include "evo/network/quic_transport.hpp"
|
||||
#include "evo/network/session_control.hpp"
|
||||
#include "evo/network/session_grant.hpp"
|
||||
@@ -18,7 +19,11 @@
|
||||
// public keys and admitted by SessionControl. A newer grant for an account closes the
|
||||
// account's previous connection with `superseded`. Refusals and closes send Close with a
|
||||
// reason, then the connection is closed after a short flush. Intentions and views are
|
||||
// later segments (10.4, 10.5). Events carry account log labels only, never grants.
|
||||
// later segments (10.5). Events carry account log labels only, never grants.
|
||||
// M10.4 (ADR-0092): established sessions send intentions (datagrams) and actions (stream);
|
||||
// IntentAdmission answers with receipts, simulated watermarks and final action outcomes.
|
||||
// The host reports its authority each poll, takes carried actions for its batches and
|
||||
// reports durable commits.
|
||||
// With a ControlLedger, control is durable and unique per world: a session that loses its
|
||||
// durable control (another region accepted a newer grant) closes with `superseded`, and
|
||||
// one whose control cannot be renewed in time closes with `shutdown`.
|
||||
@@ -39,6 +44,13 @@ struct RegionSessionsConfig {
|
||||
// `renew_interval` and closes before its control can lapse (`safety_margin`).
|
||||
network::ControlLedger* ledger{};
|
||||
std::chrono::milliseconds renew_interval{5000}, safety_margin{2000};
|
||||
network::IntentLimits intents{}; // max_sessions follows control.max_sessions.
|
||||
};
|
||||
// The region host's authority, read once per poll.
|
||||
struct HostFacts {
|
||||
bool ready{}; // Current authority, recovered, not draining.
|
||||
std::uint64_t epoch{}; // Ownership epoch; a newer one closes every session.
|
||||
std::uint64_t simulated_tick{};
|
||||
};
|
||||
enum class RegionSessionsError : std::uint8_t { configuration, keys, transport };
|
||||
struct RegionSessionEvent {
|
||||
@@ -55,10 +67,16 @@ class RegionSessions {
|
||||
RegionSessions(const RegionSessions&) = delete;
|
||||
RegionSessions& operator=(const RegionSessions&) = delete;
|
||||
~RegionSessions();
|
||||
// `epoch` is the region's current ownership epoch: a newer one closes every session
|
||||
// (stale_epoch). `now_seconds` is wall time for grants, `now` monotonic for deadlines.
|
||||
void poll(std::uint64_t epoch, std::uint64_t now_seconds,
|
||||
// A newer epoch closes every session (stale_epoch) and abandons unscheduled actions.
|
||||
// `now_seconds` is wall time for grants, `now` monotonic for deadlines.
|
||||
void poll(const HostFacts& facts, std::uint64_t now_seconds,
|
||||
std::chrono::steady_clock::time_point now);
|
||||
// Actions scheduled for ticks <= `tick`, to be recorded durably with the batch that
|
||||
// simulates that tick (10.4b). Each action is returned once.
|
||||
[[nodiscard]] std::vector<network::CarriedAction> carry(std::uint64_t tick);
|
||||
// A commit covering ticks up to `end_tick` is durable: carried actions become final and
|
||||
// their outcomes are sent to each account's current session.
|
||||
void committed(std::uint64_t end_tick, std::uint64_t commit_sequence);
|
||||
// Closes every connection with `shutdown` (flushed by later polls).
|
||||
void shutdown(std::chrono::steady_clock::time_point now);
|
||||
[[nodiscard]] std::vector<RegionSessionEvent> take_events();
|
||||
|
||||
Reference in New Issue
Block a user