Add primitive object publication and recovery adapter (M11.2c-2d)
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Successful in 12m22s
Foundation / checks (network) (push) Successful in 13m52s
Foundation / checks (tsan) (push) Successful in 8m7s
Foundation / checks (checks) (push) Successful in 33m54s
Foundation / checks (postgres) (push) Successful in 47m38s
Foundation / postgres-tools (push) Successful in 19s
Foundation / image (push) Successful in 2m39s
Foundation / server-image (push) Successful in 4m16s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Successful in 12m22s
Foundation / checks (network) (push) Successful in 13m52s
Foundation / checks (tsan) (push) Successful in 8m7s
Foundation / checks (checks) (push) Successful in 33m54s
Foundation / checks (postgres) (push) Successful in 47m38s
Foundation / postgres-tools (push) Successful in 19s
Foundation / image (push) Successful in 2m39s
Foundation / server-image (push) Successful in 4m16s
This commit is contained in:
@@ -661,6 +661,35 @@ reject_primitive_life(Postgres& db, RegionKey key, const LeaseGrant& lease, cons
|
||||
return static_cast<LifeRefusal>(*refusal);
|
||||
}
|
||||
|
||||
std::expected<std::vector<PrimitiveLifeBinding>, LifeReservationFailure>
|
||||
load_primitive_lives(Postgres& db, RegionKey key, milliseconds timeout) {
|
||||
const std::array<std::string, 2> p{std::to_string(key.world), std::to_string(key.region)};
|
||||
auto rows = db.query("SELECT * FROM evolution.load_primitive_lives($1::evolution.u64, "
|
||||
"$2::evolution.u64)",
|
||||
p, timeout);
|
||||
if (!rows)
|
||||
return std::unexpected{life_failure(rows.error())};
|
||||
if (rows->size() > 256)
|
||||
return std::unexpected{LifeReservationFailure{LifeReservationError::store, {}}};
|
||||
std::vector<PrimitiveLifeBinding> out;
|
||||
out.reserve(rows->size());
|
||||
for (const auto& row : *rows) {
|
||||
if (row.size() != 6)
|
||||
return std::unexpected{LifeReservationFailure{LifeReservationError::store, {}}};
|
||||
const auto account = parse_uuid(row[0]);
|
||||
const auto request = parse_integer<std::uint64_t>(row[1]);
|
||||
const auto identity = parse_integer<std::uint64_t>(row[2]);
|
||||
const auto born = parse_integer<std::uint64_t>(row[3]);
|
||||
const auto commit = parse_uuid(row[4]);
|
||||
const auto sequence = parse_integer<std::uint64_t>(row[5]);
|
||||
if (!account || !request || *request == 0 || !identity || *identity == 0 || !born ||
|
||||
*born == 0 || !commit || !sequence)
|
||||
return std::unexpected{LifeReservationFailure{LifeReservationError::store, {}}};
|
||||
out.push_back({*account, *request, *identity, *born, *commit, *sequence});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// Schema v12 probe records and handoff (ADR-0096). Shares this file's parsing rules.
|
||||
namespace {
|
||||
ProbeStoreFailure probe_failure(const PgFailure& f) {
|
||||
|
||||
Reference in New Issue
Block a user