20#define RTE_CHECKPOINT_SENDER_ID ((uint32_t)0xC4EC0001U)
44#define RTE_CHECKPOINT_RETRY_ROUND_MS ((rte_duration_ms_t)250U)
67#define RTE_CHECKPOINT_MIN_ROUNDS_PER_BUDGET ((rte_duration_ms_t)3U)
79#define RTE_CHECKPOINT_MAX_ROUNDS ((uint32_t)64U)
101 uint8_t payload_bytes[4];
116 sizeof(payload_bytes));
137 uint8_t payload_out[4];
138 uint8_t payload_size_out = 0U;
139 bool confirmed =
false;
141 reply, checkpoint_id, payload_out,
sizeof(payload_out), &payload_size_out);
143 if ((verify_status ==
RTE_STATUS_OK) && (payload_size_out ==
sizeof(payload_out)))
149 uint32_t decoded_id = 0U;
157 && (decoded_id == checkpoint_id))
214 bool confirmed =
false;
218 *out_last_send_status = send_status;
227 if (sub_budget_ms > round_cap_ms)
229 sub_budget_ms = round_cap_ms;
233 *out_last_recv_status = recv_status;
243 uint32_t channel_count;
247 if ((voter == NULL) || (config == NULL))
264 uint32_t confirmed_count = 0U;
269 uint32_t round_count = 0U;
274 if ((budget_based_round_cap_ms > 0U) && (budget_based_round_cap_ms < round_cap_ms))
276 round_cap_ms = budget_based_round_cap_ms;
281 channel_confirmed[i] =
false;
304 while ((confirmed_count < config->expected_node_count)
308 for (i = 0U; i < channel_count; i++)
315 if (checkpoint_try_channel(voter, i, &arrival_msg, config->
checkpoint_id, start_ms, &now_ms,
321 channel_confirmed[i] =
true;
371 char diag_message[96];
373 (void)snprintf(diag_message,
sizeof(diag_message),
374 "checkpoint confirmed=%u expected=%u channels=%u last_send=%d last_recv=%d",
376 (
unsigned int)channel_count, (
int)last_send_status, (
int)last_recv_status);
382 (int32_t)__LINE__, diag_message);
rte_status_t rte_buffer_set_length(rte_buffer_t *buf, size_t length)
Marks length bytes of already-written storage as valid.
rte_status_t rte_buffer_write_u32_le(rte_buffer_t *buf, uint32_t value)
Appends a little-endian uint32_t at buf's current length.
rte_status_t rte_buffer_init(rte_buffer_t *buf, void *storage, size_t capacity)
Binds a buffer view to caller-owned storage. Initial length is 0.
rte_status_t rte_buffer_read_u32_le(const rte_buffer_t *buf, size_t offset, uint32_t *out_value)
Reads a little-endian uint32_t at the given offset.
rte_status_t rte_channel_checkpoint(rte_voter_t *voter, const rte_checkpoint_config_t *config)
Performs one bounded checkpoint rendezvous across every channel registered with a voter.
rte_status_t rte_checksum_vital_message_verify(const rte_vital_message_t *msg, uint32_t expected_sequence, uint8_t *payload_out, size_t payload_max_size, uint8_t *payload_size_out)
Verify vital channel message and extract payload.
rte_status_t rte_checksum_vital_message_create(rte_vital_message_t *msg_out, uint32_t sender_id, uint32_t sequence, const uint8_t *payload, size_t payload_size)
Create vital channel message with CRC.
#define RTE_SAFESTATE_REASON_CHECKPOINT_TIMEOUT
void rte_safestate_enter(rte_safestate_level_t level, rte_safestate_reason_t reason, const char *file, int32_t line, const char *message)
Enters a safe-state level: invokes the registered handler (if any), then, for RTE_SAFESTATE_LEVEL_SAF...
@ RTE_SAFESTATE_LEVEL_SAFE
rte_status_t
Common result/status codes.
@ RTE_STATUS_INVALID_PARAM
rte_status_t rte_timer_now(rte_timestamp_ms_t *out_now_ms)
Returns the current monotonic time base used by all timers.
uint32_t rte_duration_ms_t
uint64_t rte_timestamp_ms_t
rte_status_t rte_watchdog_kick(rte_watchdog_t watchdog)
Kick (pet) watchdog - prove liveness.
rte_status_t rte_channel_receive(rte_channel_t *handle, void *data, size_t data_size, uint32_t timeout_ms)
Receives data on this channel via its OSAdapter receive callback.
rte_channel_storage_t rte_channel_t
Opaque handle to a vital channel instance.
rte_status_t rte_channel_send(rte_channel_t *handle, const void *data, size_t data_size)
Sends data on this channel via its OSAdapter send callback.
rte_voter_storage_t rte_voter_t
Opaque handle to a voter instance.
#define RTE_VOTER_MAX_CHANNELS
Maximum number of channels a single voter can register.
rte_channel_t * rte_voter_get_channel(const rte_voter_t *voter, uint32_t index)
Direct access to one registered channel, by index.
uint32_t rte_voter_get_channel_count(const rte_voter_t *voter)
Number of channels currently registered with this voter.
Cross-layer data buffer abstraction (ADR-002).
static rte_duration_ms_t remaining_budget_ms(rte_timestamp_ms_t start_ms, rte_timestamp_ms_t now_ms, rte_duration_ms_t max_delay_ms)
Returns the time budget remaining until start_ms + max_delay_ms.
static rte_status_t build_arrival_message(uint32_t checkpoint_id, rte_vital_message_t *out_msg)
Builds the checkpoint-arrival marker message.
static bool reply_confirms_checkpoint(const rte_vital_message_t *reply, uint32_t checkpoint_id)
Verifies a candidate reply's CRC/sequence (via rte_checksum) and that its decoded payload matches che...
#define RTE_CHECKPOINT_SENDER_ID
#define RTE_CHECKPOINT_RETRY_ROUND_MS
#define RTE_CHECKPOINT_MAX_ROUNDS
#define RTE_CHECKPOINT_MIN_ROUNDS_PER_BUDGET
Bounded checkpoint rendezvous for distributed vital channels (ADR-017).
Checksum and CRC utilities for data integrity in redundant systems.
Safe-state transitions and checked assertions (ADR-004).
OS Abstraction Layer - Timer service.
Mutable, bounds-tracked view over caller-owned storage.
Checkpoint configuration.
rte_duration_ms_t max_delay_ms
uint32_t expected_node_count
Vital channel message with integrated CRC-64.