def __init__(self, algorithm_host, algorithm, algorithm_port):
self.algorithm = algorithm
self.algorithm_port = algorithm_port
if algorithm == "rethinkdb":
self.rdb_connection = r.connect('localhost', self.algorithm_port)
logging.info("Connection with RethinkDB successful")
rethinkdb_setup(self.rdb_connection)
self.appendFunction = partial(rethinkdb_append_entry, self.rdb_connection)
elif algorithm == "paxos" or algorithm == "pso":
if algorithm_host == '\'\'' or algorithm_host == '':
algorithm_host = '127.0.0.1'
self.cluster_rpc_client = ServerProxy("http://{}:{}".format(algorithm_host, CLUSTER_APPEND_PORT),
allow_none=True)
self.appendFunction = partial(cluster_append_entry, self.cluster_rpc_client)
elif algorithm == "datastore":
self.appendFunction = partial(datastore_append_entry)
# wrapper used to execute multiple operations and register times
评论列表
文章目录