25 d.reason = RTE_SITE_ROLE_REASON_NONE;
103 const char *text =
"none";
108 text =
"both sites FAULTED, WEST wins";
111 text =
"counterpart FAULTED";
114 text =
"was FAULTED, counterpart healthy ONLINE";
117 text =
"dispatcher confirmed the other site is not ONLINE";
120 text =
"negotiation - both sites STANDBY, WEST wins the tie";
123 text =
"negotiation - both sites STANDBY, joining the ONLINE A/B sibling";
126 text =
"counterpart took over while this channel was cut off";
129 text =
"both sites ONLINE without a lost-contact history";
132 text =
"promotion held back until both A/B channels are ready";
134 case RTE_SITE_ROLE_REASON_NONE:
143 const char *token =
"none";
148 token =
"both_faulted";
151 token =
"peer_faulted";
157 token =
"dispatcher";
160 token =
"both_standby_west";
163 token =
"both_standby_sibling";
169 token =
"dual_online";
172 token =
"waiting_ready";
174 case RTE_SITE_ROLE_REASON_NONE:
186 if (sync_enabled && is_online && link_up)
203 uint32_t last_rx_cycle)
207 if (sync_enabled && !is_online && have_snapshot)
217 uint32_t cycle, uint32_t confirm_cycle)
219 bool allowed =
false;
221 if (!is_online && !own_faulted && peer_unresponsive && confirmed)
static bool peer_answering(const rte_site_role_input_t *in)
static bool pair_ready_to_promote(const rte_site_role_input_t *in)
Site-role policy: one pure decision function for "should this channel promote, demote or stay?...
bool rte_site_role_standby_data_stale(bool sync_enabled, bool is_online, bool have_snapshot, uint32_t cycle, uint32_t last_rx_cycle)
Whether STANDBY's held snapshot is stale and must be dropped (STANDBY goes cold).
rte_site_role_decision_t rte_site_role_decide(const rte_site_role_input_t *in)
Decides this cycle's role action. Rules are evaluated in this order and the first that applies wins:
@ RTE_SITE_ROLE_REASON_DUAL_ONLINE
@ RTE_SITE_ROLE_REASON_WAITING_READY
@ RTE_SITE_ROLE_REASON_PEER_FAULTED
@ RTE_SITE_ROLE_REASON_BOTH_FAULTED
@ RTE_SITE_ROLE_REASON_DISPATCHER_CONFIRMED
@ RTE_SITE_ROLE_REASON_BOTH_STANDBY_SIBLING
@ RTE_SITE_ROLE_REASON_RECOVERED
@ RTE_SITE_ROLE_REASON_YIELD_TO_TAKEOVER
@ RTE_SITE_ROLE_REASON_BOTH_STANDBY_WEST
const char * rte_site_role_reason_text(rte_site_role_reason_t reason)
bool rte_site_role_both_standby_tiebreak(uint32_t both_standby_cycles, bool is_west, bool sibling_online)
Negotiation tie-break for "both sites STANDBY": a channel whose A/B sibling is already ONLINE joins i...
@ RTE_SITE_ROLE_ACTION_NONE
@ RTE_SITE_ROLE_ACTION_RENEGOTIATE
@ RTE_SITE_ROLE_ACTION_PROMOTE
@ RTE_SITE_ROLE_ACTION_DEMOTE
@ RTE_SITE_ROLE_ACTION_WAIT
@ RTE_SITE_ROLE_ACTION_ALARM
#define RTE_SITE_ROLE_STANDBY_SYNC_RETRY_CYCLES
bool rte_site_role_takeover_allowed(bool is_online, bool own_faulted, bool peer_unresponsive, bool confirmed, uint32_t cycle, uint32_t confirm_cycle)
Whether a STANDBY channel may promote itself because its counterpart stopped responding....
#define RTE_SITE_ROLE_STANDBY_DATA_TIMEOUT_CYCLES
#define RTE_SITE_ROLE_TAKEOVER_CONFIRM_VALID_CYCLES
#define RTE_SITE_ROLE_BOTH_STANDBY_CYCLES
bool rte_site_role_standby_sync_due(bool sync_enabled, bool is_online, bool link_up, bool healthy, uint32_t cycle, uint32_t last_try)
Whether ONLINE should attempt the pre-commit standby sync this cycle.
const char * rte_site_role_reason_token(rte_site_role_reason_t reason)
uint32_t both_standby_cycles