WorkerRegistration
Registers a worker with the control plane and restores missing container assignments after the control-plane document is replaced.
Nebula · Packages/com.1by3.nebula/Runtime/Worker/WorkerRegistration.cspublic sealed class WorkerRegistrationRegisters a worker with the control plane and restores missing container assignments after the control-plane document is replaced. Existing assignments are preserved.
Fields
WorkerId
public string WorkerId = "";WorkerIndex
public uint WorkerIndex;Address
public string Address = "";Port
public ushort Port;Properties
IsRegistered
public bool IsRegistered { get; }Whether registration has been requested since construction or the last Forget call.
RegistrationCount
public int RegistrationCount { get; }Total registration requests issued by this instance, including requests queued for remote delivery.
Methods
Register
public bool Register(IControlPlane controlPlane);Requests the initial worker registration when the control plane is connected. Does nothing if registration has already been requested.
Returns: True if this call issued a registration request.
RegisterAgainIfForgotten
public bool RegisterAgainIfForgotten(IControlPlane controlPlane);Requests registration again if the connected control plane no longer lists this worker. Call from IControlPlane.Changed after initial registration; polling can issue duplicate requests while a remote control plane is waiting for the updated document.
Returns: True if this call issued a registration request. The worker can then send a heartbeat immediately.
Forget
public void Forget();Clears the local registration flag without unregistering the worker on the control plane.
IsDeclaredDead
public bool IsDeclaredDead(IControlPlane controlPlane);Whether the control plane has declared this worker dead: a document this worker has been listed in no longer lists it. The orchestrator removes the row of a worker whose heartbeats stopped and deals its containers to someone else, so the leases this worker still simulates may be restored elsewhere from their last checkpoint (docs/persistence-durability.md D10). A row missing from a replacement document is a control plane that came back empty, not a verdict: that is ReclaimContainers' case (docs/control-plane-availability.md D1b). Call before RegisterAgainIfForgotten, which can put the row straight back on an in-process control plane.
IsFenced
public bool IsFenced(IControlPlane controlPlane, float timeoutSeconds);Whether this worker must stop acting as the owner of its leases: it has been declared dead (IsDeclaredDead), or its own row, as its mirror of the control plane shows it, has not had a heartbeat for more than timeoutSeconds — the same test, on the same clock, the orchestrator applies before it declares a worker dead. A fenced worker writes nothing to the persistence store, reads nothing back and hands nothing over; it keeps simulating, and it is unfenced by its next heartbeat landing (docs/persistence-durability.md D8). False before the worker has seen its own row in the current document: nothing is leased to it there yet.
ReclaimContainers
public int ReclaimContainers(IControlPlane controlPlane);Requests missing leases, which assign containers to workers, for containers this worker still owns. Call on each control-plane change before applying the updated leases. Reconciliation runs once for each new IControlPlane.DocumentId; removals within the same document are preserved.
Existing leases and dynamic containers are skipped. Runtime containers are reclaimed with their bounds and instance metadata; other containers are ensured and assigned to this worker.
Returns: The number of containers for which this call issued reclaim requests.
WorkerQuery
Sends one game-defined request to several workers and collects their replies.
WorkerScopeLifecycle
The worker's half of the scope lifecycle (docs/scope-lifecycle.md): it keeps the idle clock of the scope parts it owns honest, performs the retire sequence for a scope the orchestrator moved to ScopeState.Retiring, and reports a restore ...