Example #1
0
    def __init__(self, network_uid, peers, state_file):
        self.messenger = None
        self.network_uid = network_uid
        self.peers = peers  # list of peer network uids
        self.quorum_size = len(peers) / 2 + 1
        self.state_file = state_file
        self.lastTime = 0  # last time node sent an update to lead proposer
        self.sendRate = 10  # num millisecs between updates sent to layer above
        self.height = self.get_height(self.network_uid)
        self.temp_updates = [
        ]  #list of string proposals waiting to be sent to level above in hieararchy

        #coordinator based data structures
        self.pending_inter_ledger = dict(
        )  # self seq_num -> transaction - may not need to use (revise new_inter_ledger fct)
        self.uncommitted_nodes = [
        ]  #list of string ids of nodes that have pending inter-ledger transactions (coordinator based)
        self.inter_ledger_seq = dict(
        )  #transaction -> seq (a list of seq num, sndr uid) --- stored in lca of coordinator based alg to track if 2 seq nums have been received for a transaction
        self.inter_ledger_transaction = dict(
        )  #seq #-> tranasaction - used by lca so that after consensus on seq # it can recover transaction and send back to clusters

        self.load_state()

        self.paxos = PaxosInstance(self.network_uid, self.quorum_size,
                                   self.promised_id, self.accepted_id,
                                   self.accepted_value)
Example #2
0
    def advance_instance(self,
                         new_instance_number,
                         new_current_value,
                         catchup=False):
        self.save_state(new_instance_number, new_current_value, None, None,
                        None)

        self.paxos = PaxosInstance(self.network_uid, self.quorum_size, None,
                                   None, None)

        print 'UPDATED: ', new_instance_number, new_current_value
Example #3
0
    def __init__(self, network_uid, peers, state_file):
        self.messenger = None
        self.network_uid = network_uid
        self.peers = peers  # list of peer network uids
        self.quorum_size = len(peers) / 2 + 1
        self.state_file = state_file

        self.load_state()

        self.paxos = PaxosInstance(self.network_uid, self.quorum_size,
                                   self.promised_id, self.accepted_id,
                                   self.accepted_value)