Nebula
Worker

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 ...

generated from the sources
public sealed class 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 finished for a scope in ScopeState.Restoring. It decides nothing — the orchestrator owns the state machine and this only ever acts on the state it reads off the control-plane document.

The retire sequence for one part, in order: the before-retire window (BeforeRetire, the seam NEB-242 exposes as OnBeforeRetire(container, cancelToken)), a forced checkpoint of every persistent entity in the part, the store's write barrier, emptying the part, and only then the acknowledgement the orchestrator waits for before it deletes the lease rows.

Constructors

WorkerScopeLifecycle

public WorkerScopeLifecycle(NebulaWorker worker);

Fields

PassSeconds

public const float PassSeconds = 0.5f;

Seconds between passes. The steps are slow and rare; a pass per frame would only cost.

BeforeRetireTimeoutSeconds

public const float BeforeRetireTimeoutSeconds = 10f;

How long the before-retire window may run before it is cancelled and the retire carries on regardless. Kept below ScopeLifecycle.StepTimeoutSeconds so the checkpoint still happens inside the orchestrator's deadline rather than being cut off by it.

ActivatingTimeoutSeconds

public const float ActivatingTimeoutSeconds = 10f;

How long the restore of a scope's parts waits for the store to answer "has this scope any records?" before it goes ahead without NebulaLifecycle.OnScopeActivating having been raised. The safety valve of docs/lifecycle-hooks.md D4: a store that never answers must not stop a scope coming back.

Properties

RetiringParts

public int RetiringParts { get; }

Parts this worker is currently retiring; for tests and the worker's own diagnostics.

Methods

Update

public void Update();

Called from the worker's frame pass. Never from the tick loop.

IsBusy

public static bool IsBusy(Container container);

Whether emptying this container now would lose something. Pure over the container's contents, including everything riding in a vehicle in it at any depth, because NebulaWorker.EmptyContainer removes riders too. A client's pawn seated in a ship parked in the part keeps the part busy. A non-persistent entity the game said it rebuilds by itself (NebulaLifecycle.DiscardOnRetire) does not.

On this page