Nebula
SpacetimeDB module

Module

generated from the sources
Static class in the global namespace · Packages/com.1by3.nebula/SpacetimeDB/Module~/Lib.cs
public static partial class Module

Methods

RegisterWorker

[SpacetimeDB.Reducer]
public static void RegisterWorker(ReducerContext ctx, string workerId, uint workerIndex, string address, ushort port);

HeartbeatWorker

[SpacetimeDB.Reducer]
public static void HeartbeatWorker(ReducerContext ctx, string workerId, string status, ulong tickCount, float tickMs, uint entityCount, uint authoritativeCount, uint ghostCount, uint playerCount, uint botCount, uint serverDrivenCount);

UnregisterWorker

[SpacetimeDB.Reducer]
public static void UnregisterWorker(ReducerContext ctx, string workerId);

RegisterGateway

[SpacetimeDB.Reducer]
public static void RegisterGateway(ReducerContext ctx, string gatewayId, string address, ushort port);

HeartbeatGateway

[SpacetimeDB.Reducer]
public static void HeartbeatGateway(ReducerContext ctx, string gatewayId);

UnregisterGateway

[SpacetimeDB.Reducer]
public static void UnregisterGateway(ReducerContext ctx, string gatewayId);

HeartbeatOrchestrator

[SpacetimeDB.Reducer]
public static void HeartbeatOrchestrator(ReducerContext ctx, string orchestratorId, uint desiredWorkers);

EnsureContainer

[SpacetimeDB.Reducer]
public static void EnsureContainer(ReducerContext ctx, string containerId);

Make sure a lease row exists for a container from the manifest.

AssignContainer

[SpacetimeDB.Reducer]
public static void AssignContainer(ReducerContext ctx, string containerId, string workerId);

Orchestrator: authoritatively assign a container to a worker. Bumps the container epoch so stale owners can be rejected.

SetLeaseState

[SpacetimeDB.Reducer]
public static void SetLeaseState(ReducerContext ctx, string containerId, string state);

ReleaseContainer

[SpacetimeDB.Reducer]
public static void ReleaseContainer(ReducerContext ctx, string containerId);

SetGameSetting

[SpacetimeDB.Reducer]
public static void SetGameSetting(ReducerContext ctx, string key, string value);

Set (or create) one mesh-wide setting. A no-op when the value is unchanged.

ResetControlPlane

[SpacetimeDB.Reducer]
public static void ResetControlPlane(ReducerContext ctx);

Dev helper: wipe all registry state (used when restarting a local mesh).

Nested types

Worker

[SpacetimeDB.Table(Accessor = "worker", Public = true)]
public partial struct Worker

A sim worker process. One row per running Nebula worker.

Fields

WorkerId
[SpacetimeDB.PrimaryKey]
public string WorkerId;
WorkerIndex
public uint WorkerIndex;

Small dense index handed out by the orchestrator. Used for entity id allocation (high bits) and debug colouring.

Address
public string Address;
Port
public ushort Port;
Status
public string Status;

starting | ready | draining | dead

LastHeartbeat
public Timestamp LastHeartbeat;
TickCount
public ulong TickCount;
TickMs
public float TickMs;
EntityCount
public uint EntityCount;

Every entity resident on the worker (authoritative + ghosts).

AuthoritativeCount
public uint AuthoritativeCount;
GhostCount
public uint GhostCount;
PlayerCount
public uint PlayerCount;

Authoritative entities owned by a human client / by a bot client / by nobody (server-driven).

BotCount
public uint BotCount;
ServerDrivenCount
public uint ServerDrivenCount;

ContainerLease

[SpacetimeDB.Table(Accessor = "container_lease", Public = true)]
public partial struct ContainerLease

Authority lease for one container. Exactly one row per container in the manifest. WorkerId == "" means unassigned/orphaned.

Fields

ContainerId
[SpacetimeDB.PrimaryKey]
public string ContainerId;
WorkerId
public string WorkerId;
Epoch
public ulong Epoch;

Monotonic per-container authority epoch. Bumped on every (re)assignment.

State
public string State;

assigning | active | draining | orphaned

UpdatedAt
public Timestamp UpdatedAt;

Gateway

[SpacetimeDB.Table(Accessor = "gateway", Public = true)]
public partial struct Gateway

A client-facing gateway process.

Fields

GatewayId
[SpacetimeDB.PrimaryKey]
public string GatewayId;
Address
public string Address;
Port
public ushort Port;
LastHeartbeat
public Timestamp LastHeartbeat;

Orchestrator

[SpacetimeDB.Table(Accessor = "orchestrator", Public = true)]
public partial struct Orchestrator

The orchestrator. Single row in practice; lets workers and gateways tell whether somebody is driving the mesh.

Fields

OrchestratorId
[SpacetimeDB.PrimaryKey]
public string OrchestratorId;
LastHeartbeat
public Timestamp LastHeartbeat;
DesiredWorkers
public uint DesiredWorkers;

GameSetting

[SpacetimeDB.Table(Accessor = "game_setting", Public = true)]
public partial struct GameSetting

A mesh-wide live setting, written by whoever is allowed to change the mesh at runtime (game code through a worker, the dashboard) and seeded by the orchestrator at start (-nebula-settings). Nebula gives them no meaning: they are the game's low-volume coordination channel (e.g. ShooterGame keeps its NPC total here).

Fields

Key
[SpacetimeDB.PrimaryKey]
public string Key;
Value
public string Value;
Version
public ulong Version;

Bumped on every change.

UpdatedAt
public Timestamp UpdatedAt;

On this page