Struct ServerControlState
The operator-controlled lifecycle state of a world or scene server.
public readonly struct ServerControlState
- Inherited Members
Remarks
The database row is the authority for both fields, not the process. A server writes them
only when an operator asks it to; on every pulse it reads them back and adopts whatever it
finds. That inversion is what makes the controls usable at all — the previous arrangement
had each server write its own in-memory locked flag on every pulse, so anything
that set the column out of band was overwritten within five seconds, and nothing in the
process ever set the flag either. It also means any tool that can write the row (the
Discord bot, the Control Panel, psql) controls the servers, exactly as the kick-request table already
does for accounts.
Constructors
ServerControlState(bool, DateTime?, double?)
Creates a control state.
public ServerControlState(bool locked, DateTime? shutdownAtUtc, double? shutdownInSeconds)
Parameters
lockedboolWhether the server is closed to new arrivals.
shutdownAtUtcDateTime?Scheduled stop time, or null.
shutdownInSecondsdouble?Seconds until
shutdownAtUtcas the database measured them when it read the row. Ignored, and stored as null, when no shutdown is scheduled.
Fields
Locked
Whether the server is closed to new arrivals.
public readonly bool Locked
Field Value
Remarks
A drain, not an eviction: players already on the server keep playing. Elevated accounts are admitted anyway, so locking a world does not lock out the operator who has to go in and look at it.
ShutdownAtUtc
When this server stops, or null when no shutdown is scheduled.
public readonly DateTime? ShutdownAtUtc
Field Value
Remarks
An absolute UTC instant on the row, so every process that reads it agrees on which shutdown is scheduled. It is the schedule's identity (a changed value is a rescheduled shutdown) and what the logs print. It is NOT what a reader counts down against: that would compare the database's clock with the reader's, see ShutdownInSeconds.
ShutdownInSeconds
Seconds from the moment the database read this row until ShutdownAtUtc,
measured by the database clock; zero or negative once the deadline has passed.
null exactly when no shutdown is scheduled.
public readonly double? ShutdownInSeconds
Field Value
Remarks
The deadline is stamped by whoever scheduled it and read by every server the shutdown
concerns, so no reader's own clock is a fair judge of how far away it is. Each server
used to subtract DateTime.UtcNow from the instant: a world host running a minute
fast stopped a minute early, one stepped forward by NTP stopped at once, and every
process serving one world counted down to a different moment. The database measures
the remaining time inside the statement that reads the row, and a reader anchors that
on its own monotonic clock the moment the reply arrives.
Properties
HasShutdown
Whether a shutdown is scheduled at all.
public bool HasShutdown { get; }