Пример #1
0
    def start(self):
        super(self.__class__, self).start()

        print 'Node %d started' % (self.addr,)

        self.client_journal = ClientJournal(self)
        self.txn_journal = TransactionJournal(self)
        for cookie in self.txn_journal.pendingOperations:
            self.completed_transactions.add(cookie)

        for command in self.client_journal.commands:
            node_addr, cmd_name, cmd_str = command.split(None, 2)
            proc = self.op(cmd_name, cmd_str)
            self.pending_cmds[command] = proc
            value = proc.next()
            self.act(int(node_addr), command, value)

        self.tid = self.client_journal.count
        # wrap up a commit that we failed during, if necessary:
        commit_snap = SnapshotCommitJournal(self, self.fs)
        commit_snap.completePendingOps()

        # Manually set up Paxos
        nodes = {0, 1, 2}
        nodes.remove(self.addr)
        other_nodes = ' '.join(str(addr) for addr in nodes)
        PaxosNode.onCommand(self, 'paxos_setup ' + other_nodes)
Пример #2
0
    def __init__(self):
        PaxosNode.__init__(self)
        ClientNode.__init__(self)

        self.pending_cmds = {}

        self.sid = 0
        self.last_sid = 0
        self.tid = 0
        self.pid = 0
        self.completed_transactions = set()

        self.snapshots = {}
        self.cache = TTLDict()
        self.op = RemoteOp()

        self.pending_proposals = {}
Пример #3
0
 def onRIOReceive(self, from_addr, protocol, msg):
     ServerNode.onRIOReceive(self, from_addr, protocol, msg)
     ClientNode.onRIOReceive(self, from_addr, protocol, msg)
     PaxosNode.onRIOReceive(self, from_addr, protocol, msg)