Files
aevolution/include/evo/server/pg_slot.hpp
T
dingoandClaude Opus 5.5 0bf9901c7f
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
Add M10.4c evo-server QUIC listener and headless session client
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>
2026-10-04 09:20:55 -04:00

32 lines
1.0 KiB
C++

#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