Ejemplo n.º 1
0
    def setUp(self):
        test_node.setup()

        self.all_nodes = set(['A', 'B', 'C'])
        self.tms       = dict()               # Node ID => TransactionManager

        self.zpax_nodes = dict() # dict of node_id => (zmq_rtr_addr, zmq_pub_addr)
                                 # we'll fake it for the test_node.NetworkNode
        
        for nid in self.all_nodes:
            self.zpax_nodes[nid] = ('foo','foo')
            
            tm = TransactionManager( test_node.Channel('test_channel', test_node.NetworkNode(nid)),    #network_channel
                                     2,                              #quorum_size,
                                     self.all_nodes,                 #all_node_ids,
                                     2,                              #threshold,
                                     durable.MemoryOnlyStateStore()) #durable

            tm.timeout_duration = 5
            tm.get_current_time = lambda : 0
            
            self.tms[ nid ] = tm

            setattr(self, nid, tm)

        for nid in self.all_nodes:
            self.tms[nid].net.connect( self.zpax_nodes )

        self.auto_flush(True)
Ejemplo n.º 2
0
    def _setup(self):

        test_node.setup()

        self.dd_store = durable.MemoryOnlyStateStore()

        self.zpax_nodes = dict()

        for uid in all_nodes:

            self.nodes[uid] = HBTestNode(test_node.Channel(
                'test_channel', test_node.NetworkNode(uid)),
                                         2,
                                         self.durable_key.format(uid),
                                         self.dd_store,
                                         hb_period=0.01,
                                         liveness_window=0.03)

            yield self.nodes[uid].initialize()

            self.zpax_nodes[uid] = ('foo', 'foo')

        for uid in all_nodes:
            self.nodes[uid].net.connect(self.zpax_nodes)

        self.nodes['A'].pax._tlast_hb = 0
        self.nodes['A'].pax._tlast_prep = 0
Ejemplo n.º 3
0
    def setUp(self):
        test_node.setup()

        self.all_nodes = set(['A', 'B', 'C'])
        self.tms = dict()  # Node ID => TransactionManager

        self.zpax_nodes = dict(
        )  # dict of node_id => (zmq_rtr_addr, zmq_pub_addr)
        # we'll fake it for the test_node.NetworkNode

        for nid in self.all_nodes:
            self.zpax_nodes[nid] = ('foo', 'foo')

            tm = TransactionManager(
                test_node.Channel(
                    'test_channel',
                    test_node.NetworkNode(nid)),  #network_channel
                2,  #quorum_size,
                self.all_nodes,  #all_node_ids,
                2,  #threshold,
                durable.MemoryOnlyStateStore())  #durable

            tm.timeout_duration = 5
            tm.get_current_time = lambda: 0

            self.tms[nid] = tm

            setattr(self, nid, tm)

        for nid in self.all_nodes:
            self.tms[nid].net.connect(self.zpax_nodes)

        self.auto_flush(True)
Ejemplo n.º 4
0
    def _setup(self):

        test_node.setup()

        self.dd_store = durable.MemoryOnlyStateStore()

        self.zpax_nodes = dict()
        
        for uid in all_nodes:

            self.nodes[uid] =  HBTestNode( test_node.Channel('test_channel', test_node.NetworkNode(uid)),
                                           2,
                                           self.durable_key.format(uid),
                                           self.dd_store,
                                           hb_period       = 0.01,
                                           liveness_window = 0.03 )

            yield self.nodes[uid].initialize()
            
            self.zpax_nodes[uid] = ('foo','foo')

        for uid in all_nodes:
            self.nodes[uid].net.connect( self.zpax_nodes )
            
        self.nodes['A'].pax._tlast_hb   = 0
        self.nodes['A'].pax._tlast_prep = 0
Ejemplo n.º 5
0
    def setUp(self):
        self.nodes       = dict()
        self.leader      = None
        self.dleader     = defer.Deferred()
        self.dlost       = None
        self.clients     = list()
        self.all_nodes   = 'a b c'.split()

        self.dd_store = durable.MemoryOnlyStateStore()

        test_node.setup()
Ejemplo n.º 6
0
    def setUp(self):
        tmpfs_dir = '/dev/shm' if os.path.exists('/dev/shm') else None
        
        self.tdir        = tempfile.mkdtemp(dir=tmpfs_dir)
        self.nodes       = dict()
        self.leader      = None
        self.dleader     = defer.Deferred()
        self.dlost       = None
        self.clients     = list()
        self.all_nodes   = 'a b c'.split()

        self.dd_store = durable.MemoryOnlyStateStore()

        test_node.setup()
Ejemplo n.º 7
0
    def setUp(self):
        tmpfs_dir = '/dev/shm' if os.path.exists('/dev/shm') else None

        self.tdir = tempfile.mkdtemp(dir=tmpfs_dir)
        self.nodes = dict()
        self.leader = None
        self.dleader = defer.Deferred()
        self.dlost = None
        self.clients = list()
        self.all_nodes = 'a b c'.split()

        self.dd_store = durable.MemoryOnlyStateStore()

        test_node.setup()
Ejemplo n.º 8
0
 def _pre_setup(self):
     test_node.setup()
Ejemplo n.º 9
0
 def _pre_setup(self):
     test_node.setup()