Table of Contents

Class MaintenanceController

Namespace
FishMMO.ControlPanel.Controllers
Assembly
FishMMO-ControlPanel.dll

Maintenance windows: locking a set of servers, draining them, and stopping them together.

[ApiController]
[Route("api/servers/maintenance")]
public sealed class MaintenanceController : ControllerBase
Inheritance
MaintenanceController
Inherited Members

Remarks

Nothing new reaches a server here. A window is the two controls on the server board — lock, and schedule a shutdown — applied to a set of servers under one record, because doing that by hand across a dozen servers is where one gets missed. Starting a window writes each server's own row through the same service the per-server buttons use.

The plan is rows, so the operator can close their laptop. The shutdown deadline is an absolute instant written onto each server; the server counts down to it inside its own process, warns its players as it passes each mark, and stops. A twenty minute drain does not need this panel, this browser or this process to be running for the shard to go down on time. What the panel does afterwards is observe: the status on these responses is derived from what the servers' rows say now, and is brought up to date by each read.

Cancelling does not unlock anything, and this controller says so every time. Scheduling a shutdown sets locked = true in the same statement, and cancelling clears the deadline alone. A cancelled window therefore leaves every target closed to new arrivals until somebody unlocks it on the board. Getting that wrong strands a shard with nobody able to log in and the cause nowhere near where anyone will look, so the acknowledgement names the servers that are still locked rather than merely warning in general terms.

Operator to read, Operator plus a step-up to write, matching the per-server controls: a window is those controls applied twelve times, and the weaker of two faces of one capability is the way around the stronger.

Constructors

MaintenanceController(IMaintenanceService, AuditScope, ILogger<MaintenanceController>)

public MaintenanceController(IMaintenanceService maintenance, AuditScope audit, ILogger<MaintenanceController> log)

Parameters

maintenance IMaintenanceService
audit AuditScope
log ILogger<MaintenanceController>

Methods

Cancel(long, ReasonRequest)

Calls off a window's scheduled shutdowns. The servers stay locked.

[HttpDelete("{id:long}")]
[Authorize(Policy = "Operator.StepUp")]
[Audited("maintenance.cancel", TargetType = "maintenance", TargetRouteValue = "id")]
public Task<IActionResult> Cancel(long id, MaintenanceController.ReasonRequest request)

Parameters

id long
request MaintenanceController.ReasonRequest

Returns

Task<IActionResult>

Fetch(long)

One window, with per-target progress.

[HttpGet("{id:long}")]
[Authorize(Policy = "Operator")]
public Task<IActionResult> Fetch(long id)

Parameters

id long

Returns

Task<IActionResult>

List(int)

Every maintenance window, newest first, each with its targets.

[HttpGet]
[Authorize(Policy = "Operator")]
public Task<IActionResult> List(int limit = 50)

Parameters

limit int

Returns

Task<IActionResult>

Start(StartRequest)

Plans a window: locks every target now, and schedules the shutdown for the end of the drain.

[HttpPost]
[Authorize(Policy = "Operator.StepUp")]
[Audited("maintenance.start", TargetType = "maintenance")]
public Task<IActionResult> Start(MaintenanceController.StartRequest request)

Parameters

request MaintenanceController.StartRequest

Returns

Task<IActionResult>