Send LastVote
This commit is contained in:
parent
8f66b98ce3
commit
01000023b6
@ -57,7 +57,21 @@ namespace paxos
|
||||
ledger.set_next_bal(ballot);
|
||||
int previous_vote = ledger.prev_vote();
|
||||
previous_vote = previous_vote;
|
||||
//XXX send a LastVote to sender
|
||||
send_last_vote(ballot, previous_vote, sender);
|
||||
}
|
||||
|
||||
void Legislator::send_last_vote(int ballot, int previous_vote,
|
||||
std::string sender)
|
||||
{
|
||||
std::string ballot_string = std::to_string(ballot);
|
||||
std::string vote_string = std::to_string(previous_vote);
|
||||
Message message;
|
||||
message.set_method("LastVote");
|
||||
message.add_header("ballot", ballot_string);
|
||||
message.add_header("vote", vote_string);
|
||||
message.add_header("sender", self->config_.name);
|
||||
SendEW::send_message(message, legislators[sender]);
|
||||
|
||||
}
|
||||
|
||||
void Legislator::receive_last_vote(Message message)
|
||||
|
@ -15,10 +15,10 @@ namespace paxos
|
||||
void initiate_ballot();
|
||||
|
||||
void send_next_ballot(int ballot);
|
||||
|
||||
void receive_next_ballot(Message message);
|
||||
void receive_next_ballot(int ballot, std::string sender);
|
||||
|
||||
void send_last_vote(int ballot, int previous_vote, std::string sender);
|
||||
void receive_last_vote(Message message);
|
||||
void receive_enough_last_vote
|
||||
(std::unordered_map<std::string, int> quorum_last_votes);
|
||||
|
Loading…
Reference in New Issue
Block a user