10#ifndef ICAROUS_CFS_RAFT_H
11#define ICAROUS_CFS_RAFT_H
18#include "cfe_platform_cfg.h"
26#define RAFT_STARTUP_INF_EID 0
27#define RAFT_COMMAND_ERR_EID 1
28#define RAFT_RECEIVED_FENCE_EID 3
30#define RAFT_PIPE_DEPTH 100
31#define RAFT_HBEATPIPE_NAME "RAFT_HBEAT_PIPE"
32#define RAFT_SCHPIPE_NAME "RAFT_SCH_PIPE"
33#define RAFT_VOTEPIPE_NAME "RAFT_VOTE_PIPE"
34#define RAFT_DATAPIPE_NAME "RAFT_DATA_PIPE"
36#define RAFT_MAJOR_VERSION 1
37#define RAFT_MINOR_VERSION 0
78 int32_t memberNodeID[MAX_NODES];
86 report_t mergingData[MAX_NODES];
88 report_t ownshipMergingData;
124void heartbeatTimeoutCallback(uint32_t timerId);
126void electionTimeoutCallback(uint32_t timerId);
128void leaderTimeoutCallback(uint32_t timerId);
132void raft_neutral(
void);
134void raft_follower(
void);
136void raft_candidate(
void);
138void raft_leader(
void);
140void raftProcessClientData(
void);
142void raftSendDataToClient(
void);
144void RAFT_SetNeutralPipeConfiguration(
void);
146void RAFT_SetFollowerPipeConfiguration(
void);
148void RAFT_SetCandidatePipeConfiguration(
void);
150void RAFT_SetLeaderPipeConfiguration(
void);
Message ID definition of common icarous messages.
void RAFT_AppMain(void)
Definition: raft.c:21
void RAFT_ProcessPacket(void)
void RAFT_AppInitializeData(void)
Definition: raft.c:160
void RAFT_AppCleanUp(void)
Definition: raft.c:178
void RAFT_AppInit(void)
Definition: raft.c:53
Defintion of messages used by raft_msg.h.
Message ID definition of raft app messages.
Struct to hold raft app data.
Definition: raft.h:58
uint32_t leaderTimeoutCounter
Leader timeout counter.
Definition: raft.h:84
CFE_SB_MsgPtr_t Raft_ClientMsgPtr
Pipe for client data.
Definition: raft.h:67
CFE_SB_MsgPtr_t Raft_SchMsgPtr
Pointer to SB message.
Definition: raft.h:65
uint32_t candidateTimerId
Candidate election timer id.
Definition: raft.h:80
int32_t nodeIntersection
Current intersection of this node.
Definition: raft.h:75
uint32_t totalVotesReceived
Total votes received.
Definition: raft.h:76
bool neutralFollower
True if no leader is available.
Definition: raft.h:94
CFE_SB_PipeId_t Raft_SchPipe
Pipe for scheduler.
Definition: raft.h:60
uint32_t hbeatTimeoutCounter
Heartbeat timeout counter.
Definition: raft.h:82
int32_t votedTerm
Voted term.
Definition: raft.h:73
FILE * logFile
Log file for debugging purposes.
Definition: raft.h:96
CFE_SB_PipeId_t Raft_VotePipe
Pipe for client data.
Definition: raft.h:61
uint32_t votedForNodeId
Node id of candidate voted for.
Definition: raft.h:74
CFE_SB_PipeId_t Raft_ClientPipe
Pipe for client data.
Definition: raft.h:62
uint32_t electionTimeoutCounter
Election timeout counter.
Definition: raft.h:83
Role_e nodeRole
Raft role of this node.
Definition: raft.h:69
bool neutralPipeInitialized
Pipe configuration for neutral role initialized.
Definition: raft.h:90
CFE_SB_MsgPtr_t Raft_HbeatMsgPtr
Pointer to SB message.
Definition: raft.h:64
bool followerPipeInitialized
Pipe configuration for follower role initialized.
Definition: raft.h:91
bool electionInitiated
Flag indicating if election was initiated.
Definition: raft.h:89
bool leaderPipeInitialized
Pipe configuration for leader role initialized.
Definition: raft.h:93
CFE_SB_PipeId_t Raft_HbeatPipe
Pipe variable.
Definition: raft.h:59
int32_t nodeTerm
Raft node's term.
Definition: raft.h:72
uint32_t logDataIndex
Log data index.
Definition: raft.h:87
uint32_t nodeID
Aircraft id of current node.
Definition: raft.h:70
uint32_t totalNodes
Total nodes in the network.
Definition: raft.h:77
uint32_t leaderID
Leader for the current network.
Definition: raft.h:71
CFE_SB_MsgPtr_t Raft_VoteMsgPtr
Pointer to SB message.
Definition: raft.h:66
bool candidatePipeInitialized
Pipe configuration for candidate role initialized.
Definition: raft.h:92
uint32_t followerTimerId
Follower heartbeat timer id.
Definition: raft.h:79
uint32_t leaderTimerId
Leader timer id.
Definition: raft.h:81