Line data Source code
1 : #ifndef HEADER_fd_src_choreo_votor_ag_event_h 2 : #define HEADER_fd_src_choreo_votor_ag_event_h 3 : 4 : /* ag_event defines events used internally by the Votor impl. The Votor 5 : algorithm is a state machine, and events represent state transitions. 6 : 7 : On a state change in one Votor component, another component reacts. 8 : For example, when ag_pool emits ag_parent_ready_t, ag_votor starts a 9 : skip timer. 10 : 11 : ag_event should not propagate outside Votor. fd_votor_tile.h defines 12 : the external-facing API for other tiles. 13 : 14 : Every event has a sequence number and a timestamp. seq allows for a 15 : total-ordering of events and ts records the wallclock time of the 16 : emitting component when it produced the event. */ 17 : 18 : #include "ag_votor_base.h" 19 : #include "ag_cert.h" 20 : #include "ag_parent_ready_tracker.h" /* ag_parent_ready_t */ 21 : #include "ag_vote.h" 22 : 23 138 : #define AG_EVENT_POOL_PARENT_READY (0) 24 39 : #define AG_EVENT_POOL_SAFE_TO_NOTAR (1) 25 36 : #define AG_EVENT_POOL_SAFE_TO_SKIP (2) 26 1146 : #define AG_EVENT_POOL_CERT_CREATED (3) 27 12 : #define AG_EVENT_POOL_STANDSTILL (4) 28 : 29 : struct ag_event_pool { 30 : ulong seq; 31 : long ts; 32 : int kind; 33 : union { 34 : ag_parent_ready_t parent_ready; 35 : ag_block_id_t safe_to_notar; 36 : ulong safe_to_skip; 37 : ag_cert_t cert_created; 38 : ag_standstill_t standstill; 39 : }; 40 : }; 41 : typedef struct ag_event_pool ag_event_pool_t; 42 : 43 69 : #define AG_EVENT_BLOCK_FIRST_SHRED (0) 44 0 : #define AG_EVENT_BLOCK_INVALID_BLOCK (1) 45 : 46 : struct ag_event_block { 47 : ulong seq; 48 : long ts; 49 : int kind; 50 : ulong slot; 51 : }; 52 : typedef struct ag_event_block ag_event_block_t; 53 : 54 27 : #define AG_EVENT_REPLAY_COMPLETED (0) 55 0 : #define AG_EVENT_REPLAY_DEAD (1) 56 : 57 : struct ag_event_replay { 58 : ulong seq; 59 : long ts; 60 : int kind; 61 : ulong slot; 62 : ag_block_info_t block_info; 63 : }; 64 : typedef struct ag_event_replay ag_event_replay_t; 65 : 66 48 : #define AG_EVENT_TIMEOUT (0) 67 6 : #define AG_EVENT_TIMEOUT_CRASHED_LEADER (1) 68 : 69 : struct ag_event_timeout { 70 : ulong seq; 71 : long ts; 72 : int kind; 73 : ulong slot; 74 : }; 75 : typedef struct ag_event_timeout ag_event_timeout_t; 76 : 77 : /* ag_event_{vote,cert,repair} do not trigger state transitions in 78 : Votor, but instead are translated into outgoing messages to other 79 : tiles (see fd_votor_tile.h). */ 80 : 81 : struct ag_event_vote { 82 : ulong seq; 83 : long ts; 84 : ag_vote_t vote; 85 : }; 86 : typedef struct ag_event_vote ag_event_vote_t; 87 : 88 : struct ag_event_cert { 89 : ulong seq; 90 : long ts; 91 : ag_cert_t cert; 92 : }; 93 : typedef struct ag_event_cert ag_event_cert_t; 94 : 95 : struct ag_event_repair { 96 : ulong seq; 97 : long ts; 98 : ag_block_id_t block; 99 : }; 100 : typedef struct ag_event_repair ag_event_repair_t; 101 : 102 : #endif