test_daemon.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:krafters 作者: GianlucaBortoli 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号