feat(scheduler-core): add scheduler admin opcode schema (task 7.4)

Adds SchedAdminAction (recordStart/recordStop/recordStatus),
SchedAdminRequest (action/recordFile), SchedAdminReply (ok/error/
recording/file/eventCount/startedAt) to controller.capnp, matching
requirements.md Req 5 AC 10 verbatim. Adds schedAdmin@42 to OPCode,
schedadminmsg@31 to Request.body, schedadminreplymsg@19 to
RequestReply.data -- the exact next-available ordinals, verified live
before implementation and re-verified byte-identical against every
existing value/member.

Deliberately schema-only, per this task's own scope -- the controller
dispatch logic (cluster.c's case OPCode_schedAdmin:) is task 10.1's
job. cluster.c, src/frontend/, src/xceadmin/, src/scheduler/ all
untouched.

Round-trip tests cover all 3 SchedAdminAction values and both
ok=true/ok=false SchedAdminReply cases, including an asymmetric
ok=false/recording=true combination that rules out a Bool-field
bit-packing mixup at the wire level.

Closes out Group 7 (Foundation: Replay Wire Format) entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dw5WnN3DXStaEaPYfACU1
This commit is contained in:
Rongsong Shen 2026-08-04 14:00:16 +00:00
parent bbb3972ae6
commit 5cd8687b32
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
4 changed files with 217 additions and 1 deletions

View file

@ -216,6 +216,31 @@ typedef struct {
int success;
} wal_ack_reply_t;
/* Scheduler admin opcode request/reply (scheduler-core task 7.4, Req 5 AC 10).
* OPCode_schedAdmin: start/stop/query a scheduler-side `.replay` recording
* session. No field-level $C.mapname on either capnp struct (per the exact
* verbatim schema spec), so -- same convention as xce_ctrlstatus_t below --
* the generated accessors and this mapped struct's field names match the
* capnp schema's camelCase names exactly (no snake_case conversion). action
* mirrors the existing HostRole/JoinData.role convention: an enum-typed
* capnp field maps to a plain `int` here, not a separate named C enum type
* (the generated `enum SchedAdminAction` in controller.capnp.h already
* supplies the SchedAdminAction_recordStart/recordStop/recordStatus
* constants for callers that want them). */
typedef struct {
int action;
char *recordFile;
} sched_admin_req_t;
typedef struct {
int ok;
char *error;
int recording;
char *file;
uint64_t eventCount;
uint64_t startedAt;
} sched_admin_reply_t;
/* ctrlstatus reply payload (controller-status spec): one configured
* controller (CtrlPeer) and the lean identity/health snapshot (CtrlStatus).
* The peers list maps via $C.mapname("peers.list")/$C.maplistcount("peers.count")
@ -265,6 +290,7 @@ typedef struct {
wal_ack_reply_t* walackreplymsg;
xce_ctrlstatus_t* ctrlstatus;
xce_fetchfile_reply_t* fetchfilereply;
sched_admin_reply_t* schedadminreplymsg;
} data;
/* Req 7: standby redirect fields — populated when status == XCE_ERR_STANDBY */
char *redirect_host;
@ -304,6 +330,7 @@ typedef struct {
wal_catchup_entry_t* walcatchupentrymsg;
snapshot_transfer_t* snapshottransfermsg;
xce_fetchfile_t* fetchfilemsg;
sched_admin_req_t* schedadminmsg;
} body;
} xce_request_t;