Admit v10 mutation choices through the cellular host and sessions
The region host checks a choice against the committed offer, reserves the successor for the next tick, and publishes it with that tick's batch; the owner's v10 session gets the receipt and final outcome. Schema v35 now refuses a checkpoint that skips a reserved choice, and the host reloads pending reservations after uncertainty, refusal or recovery (ADR-0121). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -94,6 +94,18 @@ class CellularBridge {
|
||||
std::uint64_t generation, std::uint64_t request) {
|
||||
return host.query_primitive_life(account.bytes, generation, request);
|
||||
};
|
||||
config.select_cellular_mutation = [&host](const network::AccountId& account,
|
||||
std::uint64_t generation,
|
||||
const network::CellularMutationAction& m) {
|
||||
const auto reply =
|
||||
host.select_mutation(account.bytes, generation, m.action_id,
|
||||
{m.life_identity, m.event_index, m.offer_tick, m.operator_id});
|
||||
server::CellularMutationAnswer answer{
|
||||
server::admit_status(reply.status), reply.tick, {}};
|
||||
if (reply.outcome)
|
||||
answer.outcome = server::action_outcome(*reply.outcome);
|
||||
return answer;
|
||||
};
|
||||
auto sessions = server::RegionSessions::create(std::move(config));
|
||||
if (!sessions)
|
||||
return fail(sessions.error() == server::RegionSessionsError::transport
|
||||
|
||||
@@ -952,6 +952,15 @@ int serve_cellular(Options& o) {
|
||||
bridge->committed(committed, finalized.commit_sequence);
|
||||
awaiting_outcomes.erase(pending);
|
||||
}
|
||||
for (const auto& mutation : host.take_finalized_mutations()) {
|
||||
network::AccountId account;
|
||||
account.bytes = mutation.account;
|
||||
std::printf("mutation committed tick=%llu result=%u\n",
|
||||
static_cast<unsigned long long>(mutation.tick),
|
||||
static_cast<unsigned>(mutation.result));
|
||||
static_cast<void>(bridge->sessions().send_mutation_outcome(
|
||||
account, server::action_outcome(mutation)));
|
||||
}
|
||||
};
|
||||
const auto finish = [&](int code) {
|
||||
set_ready(false);
|
||||
@@ -1051,13 +1060,15 @@ int serve_cellular(Options& o) {
|
||||
if (!builder) {
|
||||
bridge->dropped(actions, true);
|
||||
} else {
|
||||
const auto appended = builder->append(tick, baseline, actions, held_births);
|
||||
const auto appended = builder->append(tick, baseline, actions, held_births,
|
||||
host.queued_mutations());
|
||||
if (!appended) {
|
||||
bridge->dropped(actions, true);
|
||||
} else {
|
||||
awaiting_outcomes.insert(awaiting_outcomes.end(), actions.begin(),
|
||||
actions.end());
|
||||
auto published = host.publish(builder->batch(), builder->actions());
|
||||
auto published = host.publish(builder->batch(), builder->actions(),
|
||||
builder->mutation_actions());
|
||||
if (!published && host.status().phase != server::HostPhase::resolving) {
|
||||
bridge->dropped(actions, true);
|
||||
std::erase_if(awaiting_outcomes, [&](const auto& action) {
|
||||
|
||||
Reference in New Issue
Block a user