#pragma once #include "evo/network/intent_admission.hpp" #include "evo/persistence/region_lease_store.hpp" #include "evo/server/pg_slot.hpp" #include #include #include #include // 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 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()>; 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, network::ActionLedgerError> find(const network::AccountId& account, std::uint64_t action_id) override; private: PgSlot* db_; persistence::RegionKey key_; LeaseSource lease_; std::chrono::milliseconds timeout_; }; } // namespace evo::server