feat(ha-prevote): add raft-library PreVote types, state, callback seam (task 1.2)
Scaffolding only (no bodies): RAFT_PRE_VOTE_WON/LOST/PENDING outcome codes; pre_vote_in_progress / pre_votes_granted / pre_vote_replies[] tally fields appended to raft_state_t; optional on_send_pre_vote_request callback. Adds RAFT_MAX_PEERS=8 to bound per-peer dedup (production cap MAX_HA_CANDIDATES=4). Existing raft election state/layout unchanged; libxce test green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0d660264f5
commit
449b8e9e93
2 changed files with 76 additions and 3 deletions
|
|
@ -9,7 +9,7 @@
|
|||
- _Requirements: 7.1_
|
||||
- _Boundary: PreVote dispatch (wire schema)_
|
||||
|
||||
- [ ] 1.2 (P) Add PreVote types, state, and callback seam to the raft library
|
||||
- [x] 1.2 (P) Add PreVote types, state, and callback seam to the raft library
|
||||
- Add PreVote outcome codes (won / lost / pending), a self-contained PreVote tally on the raft state (granted count, per-peer replied tracking, in-progress flag), and an optional send-pre-vote callback in the callback table.
|
||||
- Header compiles with the new declarations and existing election state/layout is unchanged; no behavior added yet.
|
||||
- _Requirements: 1.2, 6.2_
|
||||
|
|
@ -90,3 +90,7 @@
|
|||
- Observable: invariant tests pass and the existing failover/rejoin regression tests remain green with PreVote enabled.
|
||||
- _Requirements: 5.2, 5.3, 6.1, 6.2, 6.3, 6.4_
|
||||
- _Depends: 2.1, 2.2, 2.3_
|
||||
|
||||
## Implementation Notes
|
||||
- (1.1) Wire opcodes `preVoteRequest @38` / `preVoteReply @39` reuse existing `RequestVoteRequest`/`RequestVoteReply` structs and union arms (`requestvotemsg @27` / `requestvotereplymsg @14`). Generated bindings live under `src/xce.build/lib/controller.capnp.h` (build artifacts, not source-committed).
|
||||
- (1.2) Raft PreVote scaffolding in `raft.h`: outcome codes `RAFT_PRE_VOTE_WON/LOST/PENDING` = 7/8/9; tally fields `pre_vote_in_progress`, `pre_votes_granted`, `pre_vote_replies[RAFT_MAX_PEERS]` appended to `raft_state_t` (after `my_priority`); optional `on_send_pre_vote_request` callback (NULL-checkable). New `#define RAFT_MAX_PEERS 8` bounds the per-peer dedup array — safe: production cap is `MAX_HA_CANDIDATES=4` (src/include/config.h:78), and it matches `RAFT_SIM_MAX_NODES=8`. Tasks 2.1/2.2/2.3 supply the function bodies and MUST keep them pure (no `term`/`voted_for`/`role` mutation, no `on_persist`). Build/test the raft layer with `cd src && nix develop --command bash tools/xce-build.sh lib`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue