Foundation / checks (deploy) (push) Successful in 3m27s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (client) (push) Successful in 12m41s
Foundation / checks (network) (push) Successful in 13m33s
Foundation / checks (tsan) (push) Successful in 7m54s
Foundation / checks (checks) (push) Successful in 32m56s
Foundation / checks (postgres) (push) Successful in 46m10s
Foundation / postgres-tools (push) Successful in 18s
Foundation / image (push) Successful in 2m33s
Foundation / server-image (push) Successful in 4m24s
The fourth dev drill showed a synchronous PostgreSQL round trip per action on the simulation thread: at admission (uniqueness) and again at commit (first-record rule). About 12 lookups landed on each commit tick (commit ticks 58-70 ms, session p99 30-39 ms). - ActionLedger::find_all; persistence::find_region_actions applies the schema v11 find_region_action to many pairs in one statement (no migration). - IntentAdmission::admit/verify: actions only the ledger can refuse wait for one verify per poll; receipts still go out in the same poll. committed() asks once per commit. - Tests: deferred_actions (network_control), find_region_actions and find_all (Postgres). - ADR-0097 fourth run, ADR-0092 amendment, VALIDATION; refresh the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.5 KiB
C++
34 lines
1.5 KiB
C++
#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 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(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;
|
|
[[nodiscard]] std::expected<std::vector<std::optional<network::ActionOutcome>>,
|
|
network::ActionLedgerError>
|
|
find_all(std::span<const network::ActionKey> keys) override; // One statement.
|
|
|
|
private:
|
|
PgSlot* db_;
|
|
persistence::RegionKey key_;
|
|
LeaseSource lease_;
|
|
std::chrono::milliseconds timeout_;
|
|
};
|
|
} // namespace evo::server
|