IWorkerHost
Where worker instances live.
Nebula.Hosting · Packages/com.1by3.nebula/Runtime/Orchestrator/Hosting/IWorkerHost.cspublic interface IWorkerHost : IDisposableWhere worker instances live. The orchestrator decides how many workers to run and which containers they own; a host decides where one runs and how to start and stop it. The reference host launches local child processes (ProcessWorkerHost); cloud hosts create one VM per worker (HetznerWorkerHost). Liveness is judged from control-plane heartbeats regardless of host; the host's IWorkerHandle.State only lets the orchestrator react sooner when a process exits or a machine disappears. Implementations must be safe to call every frame; slow work happens off the main thread and is surfaced from Tick.
Properties
Name
string Name { get; }"process", "hetzner", ... shown on the dashboard.
IsReady
bool IsReady { get; }True once Initialize finished its asynchronous part and launches can proceed.
InitializationError
string InitializationError { get; }Set when Initialize failed permanently (bad token, missing network); the orchestrator reports it and launches nothing.
SupportsParking
bool SupportsParking { get; }True when Park is cheaper than Kill plus a fresh Launch, so the orchestrator parks a retired worker into the idle pool instead of killing it. False on hosts where an instance costs nothing to recreate (ProcessWorkerHost) and on hosts written before parking existed (WorkerHostBase answers false), which keeps the old behaviour exactly.
TypicalBootSeconds
float TypicalBootSeconds { get; }Roughly how long this host takes to get a freshly launched worker simulating: the cost of a cold start, used for the scale-to-zero warning and for the dashboard's idle-pool copy. Process host ~3 s, a cloud VM that boots an image and downloads a build ~75 s.
Methods
Initialize
void Initialize(Action<string, string> log);Called once before the first launch. Hosts use it to look up cloud resources and to sweep leftovers from a previous orchestrator run (a crashed orchestrator must not leave paid machines behind).
Launch
IWorkerHandle Launch(WorkerLaunchSpec spec);Kill
void Kill(IWorkerHandle handle);Stop the worker immediately (crash semantics: kill the process, delete the machine).
Park
void Park(IWorkerHandle handle, float idlePoolSeconds);Retire the worker into the idle pool: the orchestrator has drained it and will deal it nothing more, but wants it back cheaply if load returns. A host that cannot park just kills the instance.
| Parameter | Description |
|---|---|
idlePoolSeconds | How long the orchestrator would like it kept (NebulaConfig.IdlePoolSeconds); 0 means "as long as it is free", which is the host's own answer (Hetzner: the rest of the hour it has been billed). |
Unpark
bool Unpark(IWorkerHandle handle);Bring a parked instance back. True when the handle is WorkerHandleState.Running again and the worker it holds keeps its id and index; false when the host has already dropped it, in which case the orchestrator launches a fresh worker instead.
Tick
void Tick();Main thread, every frame: apply results of background work to the handles and refresh their state.
WriteHandleJson
void WriteHandleJson(IWorkerHandle handle, JsonWriter w);Extra host-specific fields for the dashboard's worker entry.