Beispiel #1
0
    def receive_accepted_c(self, from_uid, instance_number, proposal_id,
                           proposal_value):
        # Only process messages for the current link in the multi-paxos chain
        if instance_number != self.instance_number:
            return

        m = self.paxos.receive_accepted(
            Accepted(from_uid, proposal_id, proposal_value))

        if isinstance(m, Resolution):
            print("----Resolution!!!")
            #get transaction from dict based on seq num (proposal_value) and then remove from dict
            if proposal_value in self.inter_ledger_transaction:
                # in lead proposer of cluster
                transaction = self.inter_ledger_transaction[proposal_value]
                del self.inter_ledger_transaction[proposal_value]
                #determine involved clusters, and their lead proposers
                sndr, rcvr, amount = transaction.split('-', 2)
                sndr_cluster = self.get_cluster(sndr)
                rcvr_cluster = self.get_cluster(rcvr)
                for addr in self.leaf_cluster_addrs(sndr_cluster):
                    self.messenger.send_lcacommit_c(addr, proposal_value,
                                                    transaction)
                for addr in self.leaf_cluster_addrs(rcvr_cluster):
                    self.messenger.send_lcacommit_c(addr, proposal_value,
                                                    transaction)
            #advance instance
            self.advance_instance(self.instance_number + 1, proposal_value)
Beispiel #2
0
    def receive_accepted(self, from_uid, instance_number, proposal_id,
                         proposal_value):
        # Only process messages for the current link in the multi-paxos chain
        if instance_number != self.instance_number:
            return

        m = self.paxos.receive_accepted(
            Accepted(from_uid, proposal_id, proposal_value))

        if isinstance(m, Resolution):
            self.advance_instance(self.instance_number + 1, proposal_value)
Beispiel #3
0
    def receive_accepted(self, from_uid, instance_number, proposal_id,
                         proposal_value):
        # Only process messages for the current link in the multi-paxos chain
        if instance_number != self.instance_number:
            return

        m = self.paxos.receive_accepted(
            Accepted(from_uid, proposal_id, proposal_value))

        if isinstance(m, Resolution):
            print("----Resolution!!!")
            if self.height == 0:
                result = self.paxos.update_ledger(proposal_value, True)
            else:
                result = self.paxos.update_ledger(proposal_value, False)

            self.send_updates(
                proposal_value
            )  #send update if last update was more than 10millisec ago
            if self.height == 0:
                self.messenger.send_reply(result)
            #self.messenger.send_reply(self.accepted_value)
            self.advance_instance(self.instance_number + 1, proposal_value)
Beispiel #4
0
 def receive_accepted(self, from_uid, instance_number, proposal_id,
                      proposal_value):
     # Only process messages for the current link in the multi-paxos chain
     msg = Accepted(from_uid, proposal_id, proposal_value)
     print("Evasdroping succeeded: The proposal value is ",
           msg.proposal_value)