# Path: code/node/enums.py
# UNSET = 0
# 
# INIT = 1
# 
# LEADER_CHANGE = 5
# 
# PROPOSE = 2
# 
# PREVOTE = 3
# 
# VOTE = 4
# 
# ACKNOWLEDGE = -1


from luckydonaldUtils.logger import logging
from .enums import UNSET, INIT, LEADER_CHANGE, PROPOSE, PREVOTE, VOTE, ACKNOWLEDGE
# -*- coding: utf-8 -*-


__author__ = 'luckydonald'
logger = logging.getLogger(__name__)


class Message(object):
    def __init__(self, type, sequence_no, node):
        if type is None:
            type = UNSET
        # end if
        assert isinstance(type, int)
        self.type = type
        self.sequence_no = sequence_no
        self.node = node  # i


    @classmethod
    def from_dict(cls, data):
        assert "type" in data
        type = data["type"]

# Path: code/node/enums.py
# UNSET = 0
# 
# INIT = 1
# 
# LEADER_CHANGE = 5
# 
# PROPOSE = 2
# 
# PREVOTE = 3
# 
# VOTE = 4
# 
# ACKNOWLEDGE = -1


# Path: code/node/messages.py
from luckydonaldUtils.logger import logging
from .enums import UNSET, INIT, LEADER_CHANGE, PROPOSE, PREVOTE, VOTE, ACKNOWLEDGE

# -*- coding: utf-8 -*-


__author__ = 'luckydonald'
logger = logging.getLogger(__name__)


class Message(object):
    def __init__(self, type, sequence_no, node):
        if type is None:
            type = UNSET
        # end if
        assert isinstance(type, int)
        self.type = type
        self.sequence_no = sequence_no
        self.node = node  # i


    @classmethod
    def from_dict(cls, data):
        assert "type" in data
        type = data["type"]

        assert type in [UNSET, INIT, LEADER_CHANGE, PROPOSE, PREVOTE, VOTE, ACKNOWLEDGE]