# Path: src/lifeRaft/messages/base.py
# class BaseMessage(object):
#     AppendEntries = 0
#     RequestVote = 1
#     RequestVoteResponse = 2
#     Response = 3
# 
#     def __init__(self, sender, receiver, term, data):
#         self._timestamp = int(time.time())
# 
#         self._sender = sender
#         self._receiver = receiver
#         self._data = data
#         self._term = term
# 
#     @property
#     def receiver(self):
#         return self._receiver
# 
#     @property
#     def sender(self):
#         return self._sender
# 
#     @property
#     def data(self):
#         return self._data
# 
#     @property
#     def timestamp(self):
#         return self._timestamp
# 
#     @property
#     def term(self):
#         return self._term
# 
#     @property
#     def type(self):
#         return self._type
# 
# Path: src/lifeRaft/messages/response.py
# class ResponseMessage(BaseMessage):
# 
#     _type = BaseMessage.Response
# 
#     def __init__(self, sender, receiver, term, data):
#         BaseMessage.__init__(self, sender, receiver, term, data)


import random
from ..messages.base import BaseMessage
from ..messages.response import ResponseMessage
            from .follower import Follower
        """This is called when the leader timeout is reached."""
        raise NotImplemented

    def on_vote_request(self, message):
        """This is called when there is a vote request."""
        return self, None

    def on_vote_received(self, message):
        """This is called when this node recieves a vote."""
        return self, None

    def on_append_entries(self, message):
        """This is called when there is a request to
        append an entry to the log.
        """
        raise NotImplemented

    def on_response_received(self, message):
        """This is called when a response is sent back to the Leader"""
        return self, None

    def on_client_command(self, message):
        """This is called when there is a client request."""
        raise NotImplemented

    @property
    def timeout(self):
        return random.uniform(self._timeout, 2.0 * self._timeout)

    def _send_response_message(self, msg, yes=True):

# Path: src/lifeRaft/messages/base.py
# class BaseMessage(object):
#     AppendEntries = 0
#     RequestVote = 1
#     RequestVoteResponse = 2
#     Response = 3
# 
#     def __init__(self, sender, receiver, term, data):
#         self._timestamp = int(time.time())
# 
#         self._sender = sender
#         self._receiver = receiver
#         self._data = data
#         self._term = term
# 
#     @property
#     def receiver(self):
#         return self._receiver
# 
#     @property
#     def sender(self):
#         return self._sender
# 
#     @property
#     def data(self):
#         return self._data
# 
#     @property
#     def timestamp(self):
#         return self._timestamp
# 
#     @property
#     def term(self):
#         return self._term
# 
#     @property
#     def type(self):
#         return self._type
# 
# Path: src/lifeRaft/messages/response.py
# class ResponseMessage(BaseMessage):
# 
#     _type = BaseMessage.Response
# 
#     def __init__(self, sender, receiver, term, data):
#         BaseMessage.__init__(self, sender, receiver, term, data)


# Path: src/lifeRaft/states/state.py
import random
from ..messages.base import BaseMessage
from ..messages.response import ResponseMessage
            from .follower import Follower

        """This is called when the leader timeout is reached."""
        raise NotImplemented

    def on_vote_request(self, message):
        """This is called when there is a vote request."""
        return self, None

    def on_vote_received(self, message):
        """This is called when this node recieves a vote."""
        return self, None

    def on_append_entries(self, message):
        """This is called when there is a request to
        append an entry to the log.
        """
        raise NotImplemented

    def on_response_received(self, message):
        """This is called when a response is sent back to the Leader"""
        return self, None

    def on_client_command(self, message):
        """This is called when there is a client request."""
        raise NotImplemented

    @property
    def timeout(self):
        return random.uniform(self._timeout, 2.0 * self._timeout)

    def _send_response_message(self, msg, yes=True):

        response = ResponseMessage(self._server._name, msg.sender, msg.term, {