Skip to main content

Module admin

Module admin 

Source
Expand description

Operator admin endpoint — single TCP listener for all server-side commands an exchange operator may send.

Authentication is Ed25519 challenge-response with operator-only keys (the same handshake used for trading sessions). After auth, the client sends one ASCII command terminated by \n:

  • PROMOTE — replica → primary leadership transition. Sets the shared promote flag; the replica receive loop observes it and exits with the recovered state. Available only when the spawn caller wired a promote flag (typically the replica path).
  • ROTATE — archive the current journal segment at the next fsync boundary and start a fresh one. Available only when the spawn caller wired a rotation flag (any node with --max-journal-mib > 0 or runtime rotation enabled).
  • DURABILITY <local|hybrid|durably-replicated> — atomically swap the active durability mode on a node running a response stage (primary, or post-promotion replica). Lets an operator resume trading at reduced durability immediately after a promotion (no restart, no client reconnects) and restore the target mode once replicas reattach. Available only when the spawn caller wired the shared mode atomic.

A command for which the corresponding flag is None is rejected with ERR <command> not available on this node\n so operators get a clear diagnostic instead of a silent no-op.

The listener stays alive for the lifetime of the process — multiple ROTATEs over a long run, and an eventual PROMOTE on a replica, all flow through the same socket. Concurrent or repeated triggers collapse via CAS in the journal stage / receive loop, so duplicate commands do not queue.

Functions§

spawn
Spawn the admin listener on a dedicated thread.