feat(ha-heartbeat-liveness): add last_activity and last_push_time state fields (task 1.1)

Add time_t last_activity to ha_state_t for standby liveness timestamp tracking.
Add time_t last_push_time to standby_ep_ctx_t for primary idle NOP suppression.
Zero-initialize last_activity in ha_init(); last_push_time zeroed by calloc.
Add test_ha_init_last_activity_is_zero to test_ha_startup.c.
This commit is contained in:
Rongsong Shen 2026-06-01 11:59:16 +00:00
parent e85100d761
commit bcb45e59d2
4 changed files with 141 additions and 2 deletions

View file

@ -183,6 +183,8 @@ typedef struct {
/* ── New fields added by raft-library spec (Task 6.2) ──────── */
cluster_t *raft_c; /* cluster_t* set by ha_start_election_async; used by raft callbacks */
void *raft_election_timeout_ctx; /* election_timeout_ctx_t* for cancel (task 6.2) */
/* ── New fields added by ha-heartbeat-liveness spec (Task 1.1) ── */
time_t last_activity; /* CLOCK_MONOTONIC seconds of last primary message; 0 = none yet */
} ha_state_t;
/* ── Public API ────────────────────────────────────────────── */