-
Notifications
You must be signed in to change notification settings - Fork 0
UML
Barkin Simsek edited this page Jan 21, 2021
·
1 revision
classDiagram
class Server {
<<Node>>
uint32_t id
vector<uint32_t> peers = painlessmesh::getNodeList
uint8_t state
uint32_t term
uint32_t votedFor
Log log
uint16_t electionAlarm
unordered_map<uint32_t, bool> votesReceived
uint32_t lastHeartBeat = painlessmesh::getNodeTime
init()
switchMode(uint8_t mode)
getMode()
setElectionAlarm()
startNewElection_candidate()
broadcastData(String data)
sendData() = painlessmesh::sendSingle()
receiveData() = painlessmesh::onReceive()
requestVote_leader(uint32_t receiver, String data)
handleVoteRequest_follower(uint32_t sender, String data)
handleVoteResponse_leader(uint32_t sender, String data)
requestAppendEntries_leader(uint32_t receiver, String data) = painlessmesh::sendBroadcast
handleAppendEntriesRequest_follower(uint32_t sender, String data)
handleAppendEntriesResponse_leader()
moveDataFromQueueToLog_leader(DataQueue queue, Log log)
sendLocalQueueDataToLeaderQueue_follower(String data)
handleNewData_leader_follower(String data)
getElectionResults()
}
class Log {
<<consensus>>
vector<String> entries
unordered_map<uint32_t, uint??_t> matchIndex
unordered_map<uint32_t, uint??_t> nextIndex
getMatchIndex(uint32_t address)
setMatchIndex(uint32_t address, uint??_t index)
getNextIndex(uint32_t address)
setNextIndex(uint32_t address, uint??_t index)
advanceCommitIndex(uint32_t address)
}
class DataQueue {
<<consensus>>
queue<tuple<uint32_t, String>> entries
pop(uint32_t address)
push(uint32_t address, String data)
}