def setUp(self): self.table = RoutingTable([("192.168.1.1", 7687), ("192.168.1.2", 7687)], [("192.168.1.3", 7687)], [], 0) self.new_table = RoutingTable([("127.0.0.1", 9001), ("127.0.0.1", 9002), ("127.0.0.1", 9003)], [("127.0.0.1", 9004), ("127.0.0.1", 9005)], [("127.0.0.1", 9006)], 300)
def setUp(self): self.table = RoutingTable( database=DEFAULT_DATABASE, routers=[("192.168.1.1", 7687), ("192.168.1.2", 7687)], readers=[("192.168.1.3", 7687)], writers=[], ttl=0, ) self.new_table = RoutingTable( database=DEFAULT_DATABASE, routers=[("127.0.0.1", 9001), ("127.0.0.1", 9002), ("127.0.0.1", 9003)], readers=[("127.0.0.1", 9004), ("127.0.0.1", 9005)], writers=[("127.0.0.1", 9006)], ttl=300, )
def __init__(self, opener, pool_config, workspace_config, routing_context, addresses): """ :param opener: :param pool_config: :param workspace_config: :param routing_context: Dictionary with routing information :param addresses: """ super(Neo4jPool, self).__init__(opener, pool_config, workspace_config) # Each database have a routing table, the default database is a special case. log.debug("[#0000] C: <NEO4J POOL> routing addresses %r", addresses) self.init_address = addresses[0] self.routing_tables = { workspace_config.database: RoutingTable(database=workspace_config.database, routers=addresses) } self.routing_context = routing_context if self.routing_context is None: self.routing_context = {} elif "address" in self.routing_context: raise ConfigurationError( "The key 'address' is reserved for routing context.") self.routing_context["address"] = str(self.init_address) self.refresh_lock = Lock()
def __init__(self, opener, pool_config, workspace_config, routing_context, addresses): super(Neo4jPool, self).__init__(opener, pool_config, workspace_config) # Each database have a routing table, the default database is a special case. log.debug("[#0000] C: <NEO4J POOL> routing addresses %r", addresses) self.routing_tables = {workspace_config.database: RoutingTable(database=workspace_config.database, routers=addresses)} self.routing_context = routing_context # self.missing_writer = False self.refresh_lock = Lock()
def __init__(self, loop, opener, config, addresses, routing_context): if loop is None: self._loop = get_event_loop() else: self._loop = loop self._opener = opener self._config = config self._pools = {} self._missing_writer = False self._refresh_lock = Lock(loop=self._loop) self._routing_context = routing_context self._max_size_per_host = config.max_size self._initial_routers = addresses self._routing_table = RoutingTable(addresses) self._activate_new_pools_in(self._routing_table)
def __init__(self, opener, pool_config, workspace_config, routing_context, address): """ :param opener: :param pool_config: :param workspace_config: :param routing_context: Dictionary with routing information :param addresses: """ super(Neo4jPool, self).__init__(opener, pool_config, workspace_config) # Each database have a routing table, the default database is a special case. log.debug("[#0000] C: <NEO4J POOL> routing address %r", address) self.address = address self.routing_tables = {workspace_config.database: RoutingTable(database=workspace_config.database, routers=[address])} self.routing_context = routing_context self.refresh_lock = Lock()
def create_routing_table(self, database): if database not in self.routing_tables: self.routing_tables[database] = RoutingTable(database=database, routers=self.get_default_database_initial_router_addresses())
def __init__(self, opener, pool_config, addresses, routing_context): super(Neo4jPool, self).__init__(opener, pool_config) self.routing_table = RoutingTable(addresses) self.routing_context = routing_context self.missing_writer = False self.refresh_lock = Lock()
def test_should_be_initially_stale(self): table = RoutingTable() assert not table.is_fresh(readonly=True) assert not table.is_fresh(readonly=False)
def test_should_be_initially_stale(self): table = RoutingTable(database=DEFAULT_DATABASE) assert not table.is_fresh(readonly=True) assert not table.is_fresh(readonly=False)