Route cellular logins to existing life owners
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 39s
Foundation / checks (ecs) (push) Successful in 2m1s
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 22s
Foundation / checks (network) (push) Canceled after 1m58s
Foundation / checks (client) (push) Canceled after 2m39s

This commit is contained in:
dingo
2026-10-11 01:32:14 -04:00
parent 636740bc55
commit a6b1c62168
11 changed files with 273 additions and 106 deletions
+21 -20
View File
@@ -29,9 +29,10 @@ namespace evo::server_app {
// owner-filtered v8 perception.
class CellularBridge {
public:
static std::optional<CellularBridge>
open(const M10Options& options, server::CellularRegionHost& host,
persistence::RegionKey key, std::uint64_t frame, const persistence::PgOptions& pg) {
static std::optional<CellularBridge> open(const M10Options& options,
server::CellularRegionHost& host,
persistence::RegionKey key, std::uint64_t frame,
const persistence::PgOptions& pg) {
if (!options.complete())
return fail("error cellular-session-config");
CellularBridge bridge;
@@ -54,16 +55,19 @@ class CellularBridge {
config.transport.port = port;
config.transport.certificate_pem_file = options.certificate;
config.transport.key_pem_file = options.key;
config.control.environment = options.environment == "dev"
? network::DeploymentEnvironment::dev
: options.environment == "stage"
? network::DeploymentEnvironment::stage
: network::DeploymentEnvironment::world0;
config.control.environment =
options.environment == "dev" ? network::DeploymentEnvironment::dev
: options.environment == "stage" ? network::DeploymentEnvironment::stage
: network::DeploymentEnvironment::world0;
config.control.world = {key.world, frame};
config.control.region = key.region;
config.control.epoch = 1;
config.control.max_sessions = 512;
config.transport.limits.max_connections = 576;
const auto life_routes = parse_life_owner_routes(options);
if (!life_routes || life_routes->empty())
return fail("error cellular-life-routes");
config.life_owner_routes = *life_routes;
network::GrantPublicKey public_key{};
std::copy(issuer.begin(), issuer.end(), public_key.begin());
config.issuer_keys.push_back({1, public_key});
@@ -73,19 +77,16 @@ class CellularBridge {
const auto lease = [&host] { return host.authority(); };
bridge.control_ =
std::make_unique<server::PostgresControlLedger>(*bridge.slot_, key, lease);
bridge.actions_ =
std::make_unique<server::PostgresActionLedger>(*bridge.slot_, key, lease);
bridge.actions_ = std::make_unique<server::PostgresActionLedger>(*bridge.slot_, key, lease);
config.ledger = bridge.control_.get();
config.actions = bridge.actions_.get();
config.accept_cellular_actions = true;
config.create_primitive_life = [&host](const network::AccountId& account,
std::uint64_t generation,
std::uint64_t request) {
std::uint64_t generation, std::uint64_t request) {
return host.create_primitive_life(account.bytes, generation, request);
};
config.query_primitive_life = [&host](const network::AccountId& account,
std::uint64_t generation,
std::uint64_t request) {
std::uint64_t generation, std::uint64_t request) {
return host.query_primitive_life(account.bytes, generation, request);
};
auto sessions = server::RegionSessions::create(std::move(config));
@@ -126,7 +127,7 @@ class CellularBridge {
std::printf("cellular %s session=%llu account=%s reason=%u\n",
event.kind == server::RegionSessionEvent::Kind::opened ? "opened"
: event.kind == server::RegionSessionEvent::Kind::closed ? "closed"
: "refused",
: "refused",
static_cast<unsigned long long>(event.session), event.account.c_str(),
static_cast<unsigned>(event.reason));
}
@@ -155,12 +156,12 @@ class CellularBridge {
const auto genome = state.archive().find(life.identity.genome);
if (!genome)
continue;
const biology::EnvironmentState environment{
state.ambient_temperature_millikelvin(), life.reserve};
const biology::EnvironmentState environment{state.ambient_temperature_millikelvin(),
life.reserve};
auto cell = client::present_organism(
life.identity.organism, voxel,
{life.position.x_um % 1'000'000}, {life.position.y_um % 1'000'000}, *genome,
life.growth, environment, client::OrganismState::alive);
life.identity.organism, voxel, {life.position.x_um % 1'000'000},
{life.position.y_um % 1'000'000}, *genome, life.growth, environment,
client::OrganismState::alive);
if (cell)
result.organisms.push_back(*cell);
}