Implement MasterElection

This should never be called from the libevent thread, right? If so, document that in the comment.