feat(ha-config-bootstrap): add 6 new opcodes and HA message structs to controller.capnp

This commit is contained in:
Rongsong Shen 2026-05-28 03:02:40 +00:00
parent 7a922cf184
commit 6adb7e806f
4 changed files with 1203 additions and 2 deletions

View file

@ -40,6 +40,12 @@ enum OPCode {
replConfig @29;
replConfigPush @30;
upgradeConfig @31;
requestVote @32;
probeConfigTag @33;
walAck @34;
upgradeConfigAck @35;
snapshotTransfer @36;
walCatchupEntry @37;
}
struct PeerInfo $C.mapname("xce_peerinfo_t") {
@ -552,6 +558,9 @@ struct RequestReply $C.mapname("xce_reply_t"){
replconfigpushreplymsg @9: ReplConfigPushReply;
upgradeconfigreplymsg @10: UpgradeConfigReply;
}
redirectHost @11: Text $C.mapname("redirect_host");
redirectPort @12: UInt16 $C.mapname("redirect_port");
}
struct TaskHost $C.mapname("xce_taskhost_t") {
@ -716,8 +725,10 @@ struct SnapshotHeader $C.mapname("capnp_snap_hdr_t") {
# ── HA heartbeat ────────────────────────────────────────────────────
struct HeartbeatMsg $C.mapname("heartbeat_msg_t") {
senderPriority @0: UInt32 $C.mapname("sender_priority");
term @1: UInt64 $C.mapname("term");
senderPriority @0: UInt32 $C.mapname("sender_priority");
term @1: UInt64 $C.mapname("term");
committedLsn @2: UInt64 $C.mapname("committed_lsn");
committedConfigTag @3: UInt64 $C.mapname("committed_config_tag");
}
# ── Config replication message structs ──────────────────────────────
@ -764,3 +775,55 @@ struct ReplEnvelope $C.mapname("capnp_repl_envelope_t") {
crc @4 :UInt32;
prevCrc @5 :UInt32;
}
# ── HA election and replication message structs (Task 1.1) ───────────
struct RequestVoteRequest $C.mapname("request_vote_req_t") {
term @0 :UInt64 $C.mapname("term");
candidateId @1 :Text $C.mapname("candidate_id");
configTag @2 :UInt64 $C.mapname("config_tag");
lastLogLsn @3 :UInt64 $C.mapname("last_log_lsn");
}
struct RequestVoteReply $C.mapname("request_vote_reply_t") {
term @0 :UInt64 $C.mapname("term");
voteGranted @1 :Bool $C.mapname("vote_granted");
peerConfigTag @2 :UInt64 $C.mapname("peer_config_tag");
peerLastLogLsn @3 :UInt64 $C.mapname("peer_last_log_lsn");
}
struct ProbeConfigTagRequest $C.mapname("probe_config_tag_req_t") {
name @0 :Text $C.mapname("name");
}
struct ProbeConfigTagReply $C.mapname("probe_config_tag_reply_t") {
configTag @0 :UInt64 $C.mapname("config_tag");
}
struct WalAckRequest $C.mapname("wal_ack_req_t") {
term @0 :UInt64 $C.mapname("term");
lsn @1 :UInt64 $C.mapname("lsn");
}
struct WalAckReply $C.mapname("wal_ack_reply_t") {
term @0 :UInt64 $C.mapname("term");
lsn @1 :UInt64 $C.mapname("lsn");
success @2 :Bool $C.mapname("success");
}
struct UpgradeConfigAck $C.mapname("upgrade_config_ack_t") {
term @0 :UInt64 $C.mapname("term");
ackedTag @1 :UInt64 $C.mapname("acked_tag");
success @2 :Bool $C.mapname("success");
}
struct SnapshotTransfer $C.mapname("snapshot_transfer_t") {
snapshotLsn @0 :UInt64 $C.mapname("snapshot_lsn");
payload @1 :Data $C.mapname("payload");
}
struct WalCatchupEntry $C.mapname("wal_catchup_entry_t") {
lsn @0 :UInt64 $C.mapname("lsn");
entryType @1 :UInt8 $C.mapname("entry_type");
payload @2 :Data $C.mapname("payload");
}