Emptyin the file
pkg/journal/journal_test.go. You may want to look at the other test in same file and those in
pkg/kvstore/kvstore_test.goto get a sense of how testing works in Go. This test should make sure that the log is actually emptied when Empty is called.
pkg/tpc/tpcfollower.go. This function is called every time the follower receives a message from the leader.
global. You are responsible for filling in these two functions to update the follower state machine and return the appropriate response.
Put. This is the function where all Two Phase Commit transactions begin. The purpose of this function is to update the leader state machine and send the correct messages to the followers. This function will call
globalRequestare responsible for sending the correct messages to the followers and parsing the response. Both functions call
SendMessage, which returns a channel where the responses will be placed. You can expect there will eventually be
voteRequest, if any of the responses are an ABORT then the function should return an ABORT. For
globalRequest, it doesn't matter what each follower returns since the only thing that can be returned is an ACK. Rather, you should block until you receive
SendMessagetakes a LeaderMsg and sends it to every follower the leader is connected to. It returns a Go channel of the responses and you can expect that there will eventually be
numFollowersitems in that channel.
SendMessagewill resend the same message to a follower that fails to respond within a timeout or responds with an error. If it is set to False, then such a follower will be considered to have responded with an ABORT by default. This may be useful in implementing the behavior of the Vote phases versus a Global phase.