RAFTNodeLog*=refobject# Needs more elaborate definition. Probably this will be a RocksDB/MDBX/SQLite Store Wrapper etc.
log_data*:seq[RAFTNodeLogEntry]# RAFT Node Log Data
# RAFT Node basic Messages definitions
RAFTMessageId*=object# Some Kind of UUID assigned to every RAFT Node Message,
# so it can be matched with it's coresponding response etc.
RAFTMessageOps*=enum
REQUEST_VOTE=0,
APPEND_LOG_ENTRY=1,
INSTALL_SNAPSHOT=2# For dynamic adding of new RAFT Nodes
RAFTMessagePayloadChecksum*=object# Checksum probably will be a SHA3 hash not sure about this at this point
RAFTMessagePayload*=refobject
data*:RAFTNodeLogEntry
checksum*:RAFTMessagePayloadChecksum
RAFTMessageBase*=refobjectofRootObj# Base Type for RAFT Node Messages
msg_id*:RAFTMessageId# Message UUID
sender_id*:RAFTNodeId# Sender RAFT Node ID
sender_term*:RAFTNodeTerm# Sender RAFT Node Term
peers*:RAFTNodePeers# List of RAFT Node IDs, which should receive this message
RAFTMessage*=refobjectofRAFTMessageBase
op*:RAFTMessageOps# Message Op - Ask For Votes, Append Entry(ies) or Install Snapshot
payload*:seq[RAFTMessagePayload]# Message Payload(s) - e.g. log entry(ies) etc. Will be empty for a Heart-Beat # Heart-Beat will be a message with Append Entry(ies) Op and empty payload
RAFTMessageResponse*=refobjectofRAFTMessageBase
success*:bool# Indicates success/failure
RAFTMessageSendCallback*=proc(raft_message:RAFTMessageBase){.nimcall,gcsafe.}# Callback for Sending RAFT Node Messages
# out of this RAFT Node. Can be used for broadcasting