Add M10.4c evo-server QUIC listener and headless session client
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m46s
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 (checks) (push) Canceled after 3m44s
Foundation / checks (client) (push) Canceled after 3m49s
Foundation / checks (network) (push) Canceled after 1m59s

evo-server gains an opt-in M10 listener (--m10-*, QUIC builds only): RegionSessions
with the PostgreSQL control and action ledgers on their own connection under the
host's lease, carried actions submitted to the host and its acknowledgements and
drops turned into outcomes. evo-session-probe is a dev-only headless client. Real
process tests cover intentions, durable action outcomes, SIGKILL before and after
an action's commit, duplicate retries and the probe. The simulated watermark now
reaches every session every tick, so clients always know the server tick.
ADR-0092.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-04 09:20:55 -04:00
co-authored by Claude Opus 5.5
parent 69f3ad7cf8
commit 0bf9901c7f
27 changed files with 1053 additions and 42 deletions
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include "evo/persistence/postgres.hpp"
#include <chrono>
#include <memory>
#include <utility>
// One lazily (re)connected PostgreSQL connection for single-owner callers such as the
// session ledgers (ADR-0091/0092). A caller that sees a store failure marks the slot broken;
// the next get() reconnects. Never retries a statement by itself.
namespace evo::server {
class PgSlot {
public:
PgSlot(persistence::PgOptions options, std::chrono::milliseconds connect_timeout)
: options_{std::move(options)}, timeout_{connect_timeout} {}
// Nullptr when no connection can be made now.
[[nodiscard]] persistence::Postgres* get() {
if (!db_)
if (auto made = persistence::Postgres::connect(options_, timeout_))
db_ = std::move(*made);
return db_.get();
}
void broken() noexcept {
db_.reset();
}
private:
persistence::PgOptions options_;
std::chrono::milliseconds timeout_;
std::unique_ptr<persistence::Postgres> db_;
};
} // namespace evo::server
@@ -1,27 +1,28 @@
#pragma once
#include "evo/network/intent_admission.hpp"
#include "evo/persistence/region_lease_store.hpp"
#include "evo/server/pg_slot.hpp"
#include <chrono>
#include <functional>
#include <optional>
#include <utility>
// M10.4b durable action records over the region's PostgreSQL lease (ADR-0092, schema v11).
// Linux only. Owned by the region host's thread, on the host's own connection. `lease`
// Linux only. Owned by the region host's thread, on its own connection slot. `lease`
// returns the host's current region lease, or nothing while it holds none; every lookup
// then reports `unavailable`, as does any store failure.
namespace evo::server {
class PostgresActionLedger final : public network::ActionLedger {
public:
using LeaseSource = std::function<std::optional<persistence::LeaseGrant>()>;
PostgresActionLedger(persistence::Postgres& db, persistence::RegionKey key, LeaseSource lease,
PostgresActionLedger(PgSlot& db, persistence::RegionKey key, LeaseSource lease,
std::chrono::milliseconds timeout = std::chrono::milliseconds{2000})
: db_{&db}, key_{key}, lease_{std::move(lease)}, timeout_{timeout} {}
[[nodiscard]] std::expected<std::optional<network::ActionOutcome>, network::ActionLedgerError>
find(const network::AccountId& account, std::uint64_t action_id) override;
private:
persistence::Postgres* db_;
PgSlot* db_;
persistence::RegionKey key_;
LeaseSource lease_;
std::chrono::milliseconds timeout_;
@@ -1,13 +1,14 @@
#pragma once
#include "evo/network/session_control.hpp"
#include "evo/persistence/account_control_store.hpp"
#include "evo/server/pg_slot.hpp"
#include <chrono>
#include <functional>
#include <optional>
#include <utility>
// M10.3c durable account control over the region's PostgreSQL lease (ADR-0091, schema v10).
// Linux only. Owned by the region host's thread, on the host's own connection. `lease`
// Linux only. Owned by the region host's thread, on its own connection slot. `lease`
// returns the host's current region lease, or nothing while it holds none (every call then
// reports `fenced`). Store failures that may have executed or are undecided report
// `unavailable`; the session layer then keeps or closes sessions by its own deadlines.
@@ -15,7 +16,7 @@ namespace evo::server {
class PostgresControlLedger final : public network::ControlLedger {
public:
using LeaseSource = std::function<std::optional<persistence::LeaseGrant>()>;
PostgresControlLedger(persistence::Postgres& db, persistence::RegionKey key, LeaseSource lease,
PostgresControlLedger(PgSlot& db, persistence::RegionKey key, LeaseSource lease,
std::chrono::milliseconds duration = std::chrono::milliseconds{20000},
std::chrono::milliseconds timeout = std::chrono::milliseconds{2000})
: db_{&db}, key_{key}, lease_{std::move(lease)}, duration_{duration}, timeout_{timeout} {}
@@ -26,7 +27,7 @@ class PostgresControlLedger final : public network::ControlLedger {
void release(const network::AccountId& account, std::uint64_t generation) override;
private:
persistence::Postgres* db_;
PgSlot* db_;
persistence::RegionKey key_;
LeaseSource lease_;
std::chrono::milliseconds duration_, timeout_;
+3
View File
@@ -128,6 +128,9 @@ template <typename State> class RegionHost {
[[nodiscard]] const HostStatus& status() const noexcept {
return status_;
}
// The current lease while this host may originate (for fenced calls made on its behalf,
// such as session control and action records); nothing otherwise.
[[nodiscard]] std::optional<persistence::LeaseGrant> authority() const;
// Read-only, for operational reporting (free space against the reserve).
[[nodiscard]] const persistence::FilesystemObjectStore& objects() const noexcept {
return *objects_;