Nebula
Persistence

PersistenceHost

Serves the orchestrator's IPersistenceStore to workers over the orchestrator's HTTP server, so a worker needs no database driver of its own (RemotePersistenceStore is its client).

generated from the sources
public sealed class PersistenceHost

Serves the orchestrator's IPersistenceStore to workers over the orchestrator's HTTP server, so a worker needs no database driver of its own (RemotePersistenceStore is its client). Every request is handled on the main thread from the orchestrator's command pump, which is where the store's callbacks land: a read returns OrchestratorHttpServer.Response.Pending and completes when the store answers, usually on the next tick. A write answers the same way, once the store's IPersistenceStore.WhenWritten barrier says the backend has it, so a worker's RemotePersistenceStore.WhenWritten is a real durability barrier and not just proof of delivery.

  • POST /api/store/save {"records":[...]}, POST /api/store/delete {"keys":[...]}, POST /api/store/clear
  • GET /api/store/record?key=, GET /api/store/all
  • POST /api/store/containers {"ids":[...]}: the records of up to MaxContainersPerLoad containers, as one {"records":[...]} list
  • POST /api/store/carried {"keys":[...]}: what up to MaxCarriersPerLoad carriers hold, as one {"records":[...]} list
  • GET /api/store/count?scope=&container=: how many records a scope (optionally one of its containers) holds, without reading them
  • GET /api/store/status: backend, whether it is connected, how many records it holds

Requests carry the mesh token in X-Nebula-Token when the mesh has one.

Constructors

PersistenceHost

public PersistenceHost(IPersistenceStore store, string token);

Fields

Prefix

public const string Prefix = "/api/store";

MaxContainersPerLoad

public const int MaxContainersPerLoad = 256;

Most container ids one POST /api/store/containers request may name. A larger request is refused with HTTP 400; RemotePersistenceStore.LoadContainers splits a longer list into requests of this size, and SqlPersistenceStore queries the database in chunks of this size.

MaxCarriersPerLoad

public const int MaxCarriersPerLoad = 256;

Most carrier keys one POST /api/store/carried request may name. A larger request is refused with HTTP 400; RemotePersistenceStore.LoadCarried splits a longer list into requests of this size, and SqlPersistenceStore queries the database in chunks of this size.

Properties

Store

public IPersistenceStore Store { get; }

Methods

TryHandle

public bool TryHandle(OrchestratorHttpServer.Request req, out OrchestratorHttpServer.Response response);

Main thread: handle req when it addresses the store. False for any other request.

On this page