Add cellular durable action record lookup
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m50s
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 (postgres) (push) Canceled after 26s
Foundation / checks (network) (push) Canceled after 1m49s
Foundation / checks (client) (push) Canceled after 2m29s

This commit is contained in:
dingo
2026-10-10 23:05:10 -04:00
parent c607c032b9
commit 08519b66af
13 changed files with 341 additions and 9 deletions
@@ -105,6 +105,17 @@ struct CommittedAction {
[[nodiscard]] std::expected<std::optional<CommittedAction>, LeaseStoreFailure>
find_region_action(Postgres& db, RegionKey key, const LeaseGrant& lease, const Uuid& account,
std::uint64_t action_id, std::chrono::milliseconds timeout);
struct CommittedActionRecord {
CommittedAction action;
std::uint16_t kind{};
std::uint8_t result{};
std::optional<std::vector<std::uint8_t>> cellular_input;
friend bool operator==(const CommittedActionRecord&, const CommittedActionRecord&) = default;
};
[[nodiscard]] std::expected<std::optional<CommittedActionRecord>, LeaseStoreFailure>
find_region_action_record(Postgres& db, RegionKey key, const LeaseGrant& lease,
const Uuid& account, std::uint64_t action_id,
std::chrono::milliseconds timeout);
// The same for several (account, action) pairs in one statement, answered in order
// (M10.9d, ADR-0097). Empty asks nothing.
struct ActionRef {
@@ -114,6 +125,10 @@ struct ActionRef {
[[nodiscard]] std::expected<std::vector<std::optional<CommittedAction>>, LeaseStoreFailure>
find_region_actions(Postgres& db, RegionKey key, const LeaseGrant& lease,
std::span<const ActionRef> actions, std::chrono::milliseconds timeout);
[[nodiscard]] std::expected<std::vector<std::optional<CommittedActionRecord>>, LeaseStoreFailure>
find_region_action_records(Postgres& db, RegionKey key, const LeaseGrant& lease,
std::span<const ActionRef> actions,
std::chrono::milliseconds timeout);
struct CommittedDecision {
std::uint64_t commit_sequence{};
@@ -20,6 +20,12 @@ class PostgresActionLedger final : public network::ActionLedger {
: 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::optional<network::DurableActionRecord>,
network::ActionLedgerError>
find_record(const network::AccountId& account, std::uint64_t action_id) override;
[[nodiscard]] std::expected<std::vector<std::optional<network::DurableActionRecord>>,
network::ActionLedgerError>
find_all_records(std::span<const network::ActionKey> keys) override;
[[nodiscard]] std::expected<std::vector<std::optional<network::ActionOutcome>>,
network::ActionLedgerError>
find_all(std::span<const network::ActionKey> keys) override; // One statement.