feat(election-iomgr-refactor): wire RDHUP failover to ha_start_election_async — task 5.2

This commit is contained in:
Rongsong Shen 2026-05-30 12:43:02 +00:00
parent 2e5681387a
commit 31a54043d5
3 changed files with 168 additions and 7 deletions

View file

@ -555,6 +555,22 @@ uint64_t ha_trigger_manual_failover_for_test(ha_state_t *ha);
* the real connect() path. Returns connected fd on success, -errno on failure.
*/
extern int (*ha_tcp_connect_hook)(const char *host, int port);
/*
* ha_rdhup_election_hook: test-only seam for ha_start_election_async in the
* RDHUP failover path.
*
* When non-NULL, ha_on_primary_ctrl_fd_rdhup() calls this INSTEAD OF the real
* ha_start_election_async() so unit tests can verify the RDHUP path triggers
* async re-election without requiring a live iomgr/delaymgr.
*
* The hook receives the same arguments that would be passed to ha_start_election_async.
* Requirements: 6.3, 6.5, 9.3.
*/
extern void (*ha_rdhup_election_hook)(ha_state_t *ha, cluster_t *c,
int n_peers, xce_candidate_t **peers,
uint64_t my_config_tag, uint64_t my_lsn,
const char *my_name);
#endif
#endif /* HA_H */