Esempio n. 1
0
 def __init__(self):
     self.retry_count = 1
     self.lock_labels = map(lambda x: "%i" % (x), range(0, 1))
     self.uuid = str(uuid.uuid1())
     config = get_config()
     if config.redis_cluster_enabled():
         startup_nodes = map(lambda x: {"host": x, "port": "%s" % (config.port())}, config.cluster_nodes())
         self.redis_client = rediscluster.StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)
     else:
         self.redis_client = redis.StrictRedis(host=config.host(), port=config.port(), db=0)
Esempio n. 2
0
 def __init__(self):
     config = get_config()
     if config.redis_cluster_enabled():
         startup_nodes = map(lambda x: {"host": x, "port": "%s" % (config.port())}, config.cluster_nodes())
         self.redis_client = rediscluster.StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)
     else:
         self.redis_client = redis.StrictRedis(host=config.host(), port=config.port(), db=0)
     self.cluster = Cluster(contact_points=config.cluster_nodes(), protocol_version=3)
     self.session = self.cluster.connect('mykeyspace')
     self.session.row_factory = decoded_dict_factory
     self._tables = {}
     self.table_columns_metadata = {}
Esempio n. 3
0
 def __init__(self):
     global eval_pool
     config = get_config()
     self.redis_client = redis.StrictRedis(host=config.host(),
                                           port=config.port(),
                                           db=0)
     self.dlm = Redlock([
         {
             "host": "localhost",
             "port": 6379,
             "db": 0
         },
     ],
                        retry_count=10)
Esempio n. 4
0
def build_driver():
    config = get_config()

    if config.backend() == "redis":
        import lib.rome.driver.redis.driver
        if config.redis_cluster_enabled():
            return lib.rome.driver.redis.driver.RedisClusterDriver()
        else:
            return lib.rome.driver.redis.driver.RedisDriver()
    if config.backend() == "cassandra":
        import lib.rome.driver.cassandra.driver
        return lib.rome.driver.cassandra.driver.CassandraDriver()
    else:
        import lib.rome.driver.riak.driver
        return lib.rome.driver.riak.driver.MapReduceRiakDriver()
Esempio n. 5
0
 def __init__(self):
     config = get_config()
     startup_nodes = map(
         lambda x: {
             "host": x,
             "port": "%s" % (config.port())
         }, config.cluster_nodes())
     self.redis_client = rediscluster.StrictRedisCluster(
         startup_nodes=startup_nodes, decode_responses=True)
     self.dlm = Redlock([
         {
             "host": "localhost",
             "port": 6379,
             "db": 0
         },
     ],
                        retry_count=10)
Esempio n. 6
0
 def __init__(self):
     config = get_config()
     if config.redis_cluster_enabled():
         startup_nodes = map(
             lambda x: {
                 "host": x,
                 "port": "%s" % (config.port())
             }, config.cluster_nodes())
         self.redis_client = rediscluster.StrictRedisCluster(
             startup_nodes=startup_nodes, decode_responses=True)
     else:
         self.redis_client = redis.StrictRedis(host=config.host(),
                                               port=config.port(),
                                               db=0)
     self.cluster = Cluster(contact_points=config.cluster_nodes(),
                            protocol_version=3)
     self.session = self.cluster.connect('mykeyspace')
     self.session.row_factory = decoded_dict_factory
     self._tables = {}
     self.table_columns_metadata = {}
Esempio n. 7
0
 def __init__(self):
     config = get_config()
     self.riak_client = riak.RiakClient(pb_port=config.port(), protocol='pbc')
Esempio n. 8
0
 def __init__(self):
     config = get_config()
     self.redis_client = redis.StrictRedis(host=config.host(), port=config.port(), db=0)
     self.dlm = Redlock([{"host": "localhost", "port": 6379, "db": 0}, ], retry_count=10)
Esempio n. 9
0
 def __init__(self):
     config = get_config()
     # startup_nodes = [{"host": "127.0.0.1", "port": "6379"}]
     startup_nodes = map(lambda x: {"host": x, "port": "%s" % (config.port())}, config.cluster_nodes())
     self.redis_client = rediscluster.StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)
     self.dlm = Redlock([{"host": "localhost", "port": 6379, "db": 0}, ], retry_count=10)
Esempio n. 10
0
 def __init__(self):
     config = get_config()
     self.riak_client = riak.RiakClient(pb_port=config.port(),
                                        protocol='pbc')