Nebula
Control plane

RemoteControlPlane

IControlPlane for a worker or gateway: a mirror of the control plane the orchestrator hosts (ControlPlaneHost), reached over HTTP at the orchestrator's dashboard address.

generated from the sources
public sealed partial class RemoteControlPlane : IControlPlane

IControlPlane for a worker or gateway: a mirror of the control plane the orchestrator hosts (ControlPlaneHost), reached over HTTP at the orchestrator's dashboard address.

A reader thread keeps one long-poll request open (GET /api/control-plane?since=<version>) and parses each document it gets; Tick swaps the parsed lists in on the main thread and raises Changed, so callers see the same threading as with any other control plane. Writes are queued and a sender thread posts them in order, batched when several are waiting; a write is never dropped while the orchestrator is unreachable, only delayed (up to MaxQueuedWrites, after which the oldest go). Now is the orchestrator's clock as of the last document plus the time since.

Both threads send their requests with blocking socket calls, not through the thread pool, so the mirror and the heartbeats keep going when the game fills the pool with blocking work. When a write has waited longer than StallWarningSeconds, or no document has arrived for longer than DisconnectAfterSeconds, Tick logs a warning that includes the thread pool's state.

Constructors

RemoteControlPlane

public RemoteControlPlane(string url, string token = null);
ParameterDescription
urlThe orchestrator's dashboard address, e.g. http://10.0.1.2:7080/.
tokenMesh token to present, or null.

Fields

LongPollSeconds

public const int LongPollSeconds = 10;

Seconds a read waits on the orchestrator for a change before it returns the unchanged document.

DisconnectAfterSeconds

public const float DisconnectAfterSeconds = LongPollSeconds + 5f;

Seconds without a successful read after which the mirror reports itself disconnected.

RetrySeconds

public const float RetrySeconds = 1f;

MaxQueuedWrites

public const int MaxQueuedWrites = 10000;

Properties

DocumentId

public string DocumentId { get; } = "";

Identity of the mirrored document, or an empty string until a document with an identity arrives.

StallWarningSeconds

public float StallWarningSeconds { get; set; } = 5f;

Seconds a write (a heartbeat, for example) may wait to reach the orchestrator before Tick logs a warning, once per stall. Set it to the orchestrator's worker timeout (NebulaConfig.WorkerTimeoutSeconds): after that long without a heartbeat, the orchestrator treats a worker or gateway as dead.

Url

public string Url { get; }

IsConnected

public bool IsConnected { get; }

Now

public DateTime Now { get; }

Workers

public IReadOnlyList<WorkerInfo> Workers { get; }

Leases

public IReadOnlyList<LeaseInfo> Leases { get; }

Gateways

public IReadOnlyList<GatewayInfo> Gateways { get; }

Settings

public IReadOnlyDictionary<string, string> Settings { get; }

Version

public long Version { get; }

Version of the document currently mirrored (-1 before the first).

PendingWrites

public int PendingWrites { get; }

Writes waiting to be sent.

Scopes

public IReadOnlyList<ScopeInfo> Scopes { get; }

Events

Changed

public event Action Changed;

Methods

Connect

public void Connect();

Tick

public void Tick();

Dispose

public void Dispose();

RegisterWorker

public void RegisterWorker(string workerId, uint workerIndex, string address, ushort port);

HeartbeatWorker

public void HeartbeatWorker(string workerId, string status, in WorkerStats s);

UnregisterWorker

public void UnregisterWorker(string workerId);

RegisterGateway

public void RegisterGateway(string gatewayId, string address, ushort port, uint incarnation = 0);

HeartbeatGateway

public void HeartbeatGateway(string gatewayId, in GatewayStats s);

UnregisterGateway

public void UnregisterGateway(string gatewayId);

SetGatewayDraining

public void SetGatewayDraining(string gatewayId, bool draining);

HeartbeatOrchestrator

public void HeartbeatOrchestrator(string orchestratorId, uint desiredWorkers);

SetSetting

public void SetSetting(string key, string value);

EnsureContainer

public void EnsureContainer(string containerId, ContainerAuthority authority = ContainerAuthority.Auto, bool ownPhysicsFrame = false, FrameInterestMode frameInterest = FrameInterestMode.WithCarrier, float frameApproachMargin = 0f);

EnsureRuntimeContainer

public void EnsureRuntimeContainer(string containerId, ContainerPlacement placement, string workerId, InstanceContainerInfo instance = null);

TouchContainer

public void TouchContainer(string containerId);

AssignContainer

public void AssignContainer(string containerId, string workerId);

PinContainer

public void PinContainer(string containerId, string workerId);

SetLeaseState

public void SetLeaseState(string containerId, string state);

SetContainerHint

public void SetContainerHint(string containerId, in ContainerHint hint);

SetContainerCapacity

public void SetContainerCapacity(string containerId, float saturation, CostComponent dominant, bool atCapacity, SaturationCause cause = SaturationCause.None);

ReleaseContainer

public void ReleaseContainer(string containerId);

RemoveContainer

public void RemoveContainer(string containerId);

ResetControlPlane

public void ResetControlPlane();

ActivateScope

public void ActivateScope(ScopeActivationRequest request);

SetScopeState

public void SetScopeState(string scopeKey, string state);

AckScopePart

public void AckScopePart(string scopeKey, string containerId, string phase, int count, string workerId);

RemoveScope

public void RemoveScope(string scopeKey);

On this page