feat(controller-status): add ctrlstatus opcode + CtrlStatus/CtrlPeer schema + typemap typedefs (task 1.1)

This commit is contained in:
Rongsong Shen 2026-06-20 04:32:42 +00:00
parent 4b75bfa4db
commit 97a501e96e
4 changed files with 59 additions and 4 deletions

View file

@ -203,6 +203,35 @@ typedef struct {
int success;
} wal_ack_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")
* to the nested { count, list } member below. */
typedef struct {
char* name;
char* host;
uint32_t port;
} xce_ctrlpeer_t;
typedef struct {
char* clusterName;
char* primaryName;
char* responderName;
uint8_t responderRole;
uint64_t term;
uint64_t configVersion;
xce_data_t* configChecksum;
uint64_t committedConfigVersion;
uint64_t committedLsn;
uint64_t appliedLsn;
unsigned fenced;
struct {
int count;
xce_ctrlpeer_t** list;
} peers;
uint32_t peerCount;
} xce_ctrlstatus_t;
typedef struct {
uint64_t seq;
uint32_t opcode;
@ -220,6 +249,7 @@ typedef struct {
request_vote_reply_t* requestvotereplymsg;
state_report_t* state_report;
wal_ack_reply_t* walackreplymsg;
xce_ctrlstatus_t* ctrlstatus;
} data;
/* Req 7: standby redirect fields — populated when status == XCE_ERR_STANDBY */
char *redirect_host;