|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Data Structures | |
| struct | rte_election_candidate_t |
| One candidate's info for one rte_election_execute() call. The caller builds this array fresh each call from whatever transport it uses to learn about the other replicas - this module does not retain it between calls except via the state recomputed into rte_election_t itself. More... | |
| struct | rte_election_t |
| One rte_election_t instance's state. Caller-owned storage; every field is private - reach it only through the functions below. More... | |
| struct | rte_election_config_t |
| Configuration for rte_election_init(). More... | |
Functions | |
| rte_status_t | rte_election_init (rte_election_t *election, const rte_election_config_t *config) |
| Initializes a rte_election_t. own_last_state starts at RTE_DUAL_STATE_IDLE (never yet evaluated). | |
| rte_status_t | rte_election_execute (rte_election_t *election, const rte_election_candidate_t *candidates, uint32_t candidate_count) |
| Evaluates one round of election against the caller-supplied candidate snapshot (REQ-ELECTION-002 through -005). Empty snapshot (candidate_count == 0, or this instance's own_id not present in it) yields RTE_DUAL_STATE_UNKNOWN - no quorum to decide anything from, same "report, do not react" posture as rte_dual_negotiator_execute() on a lost peer. | |
| rte_dual_state_t | rte_election_get_own_state (const rte_election_t *election) |
| Returns this instance's own current rte_dual_state_t, as of the last rte_election_execute() call. | |
| rte_status_t | rte_election_get_winner_id (const rte_election_t *election, uint32_t *out_id) |
| Returns the last-elected winner's id. | |
| rte_status_t rte_election_init | ( | rte_election_t * | election, |
| const rte_election_config_t * | config ) |
Initializes a rte_election_t. own_last_state starts at RTE_DUAL_STATE_IDLE (never yet evaluated).
| election | Caller-owned storage to initialize. Must not be NULL. |
| config | Configuration. Must not be NULL. |
Local variables declarations Global functions
Definition at line 21 of file rte_election.c.
| rte_status_t rte_election_execute | ( | rte_election_t * | election, |
| const rte_election_candidate_t * | candidates, | ||
| uint32_t | candidate_count ) |
Evaluates one round of election against the caller-supplied candidate snapshot (REQ-ELECTION-002 through -005). Empty snapshot (candidate_count == 0, or this instance's own_id not present in it) yields RTE_DUAL_STATE_UNKNOWN - no quorum to decide anything from, same "report, do not react" posture as rte_dual_negotiator_execute() on a lost peer.
| election | Initialized election. Must not be NULL. |
| candidates | This round's snapshot. May be NULL only if candidate_count is 0. |
| candidate_count | Number of entries in candidates; must not exceed RTE_REDUNDANCY_CONFIG_MAX_REPLICAS (RTE_STATUS_INVALID_PARAM if it does - a caller-side bug, not a runtime condition to degrade gracefully from). |
Definition at line 36 of file rte_election.c.
| rte_dual_state_t rte_election_get_own_state | ( | const rte_election_t * | election | ) |
Returns this instance's own current rte_dual_state_t, as of the last rte_election_execute() call.
| election | Election to query. May be NULL (returns RTE_DUAL_STATE_IDLE, defensive default). |
Definition at line 83 of file rte_election.c.
| rte_status_t rte_election_get_winner_id | ( | const rte_election_t * | election, |
| uint32_t * | out_id ) |
Returns the last-elected winner's id.
| election | Election to query. May be NULL. |
| out_id | Receives the winner's id. Must not be NULL. |
Definition at line 92 of file rte_election.c.