示例#1
0
def start_services(node: QRLNode):
    public_server = grpc.server(
        ThreadPoolExecutor(max_workers=1),
        maximum_concurrent_rpcs=config.user.max_peers_limit)
    add_BaseServicer_to_server(BaseService(node), public_server)
    add_PublicAPIServicer_to_server(PublicAPIService(node), public_server)

    public_server.add_insecure_port("[::]:9009")
    public_server.start()

    logger.info("grpc public service - started !")

    admin_server = grpc.server(
        ThreadPoolExecutor(max_workers=1),
        maximum_concurrent_rpcs=config.user.max_peers_limit)
    add_AdminAPIServicer_to_server(AdminAPIService(node), admin_server)

    admin_server.add_insecure_port("127.0.0.1:9008")
    admin_server.start()

    mining_server = grpc.server(
        ThreadPoolExecutor(max_workers=1),
        maximum_concurrent_rpcs=config.user.max_peers_limit)
    add_MiningAPIServicer_to_server(MiningAPIService(node), mining_server)
    mining_server.add_insecure_port("[::]:9007")
    mining_server.start()

    logger.info("grpc admin service - started !")

    return admin_server, public_server, mining_server
示例#2
0
文件: services.py 项目: AlephC/QRL
def start_services(node: QRLNode):
    server = grpc.server(ThreadPoolExecutor(max_workers=1))

    add_BaseServicer_to_server(BaseService(node), server)
    add_P2PNodeServicer_to_server(P2PService(node), server)
    add_PublicAPIServicer_to_server(APIService(node), server)

    server.add_insecure_port("[::]:9009")
    server.start()
    logger.debug("grpc node - started !")

    return server
示例#3
0
文件: services.py 项目: zeta1999/QRL
def start_services(node: QRLNode):
    public_server = grpc.server(
        ThreadPoolExecutor(max_workers=config.user.public_api_threads),
        maximum_concurrent_rpcs=config.user.public_api_max_concurrent_rpc)
    add_BaseServicer_to_server(BaseService(node), public_server)
    add_PublicAPIServicer_to_server(PublicAPIService(node), public_server)

    if config.user.public_api_enabled:
        public_server.add_insecure_port("{0}:{1}".format(
            config.user.public_api_host, config.user.public_api_port))
        public_server.start()

        logger.info("grpc public service - started !")

    admin_server = grpc.server(
        ThreadPoolExecutor(max_workers=config.user.admin_api_threads),
        maximum_concurrent_rpcs=config.user.admin_api_max_concurrent_rpc)
    add_AdminAPIServicer_to_server(AdminAPIService(node), admin_server)

    if config.user.admin_api_enabled:
        admin_server.add_insecure_port("{0}:{1}".format(
            config.user.admin_api_host, config.user.admin_api_port))
        admin_server.start()

        logger.info("grpc admin service - started !")

    mining_server = grpc.server(
        ThreadPoolExecutor(max_workers=config.user.mining_api_threads),
        maximum_concurrent_rpcs=config.user.mining_api_max_concurrent_rpc)
    add_MiningAPIServicer_to_server(MiningAPIService(node), mining_server)

    if config.user.mining_api_enabled:
        mining_server.add_insecure_port("{0}:{1}".format(
            config.user.mining_api_host, config.user.mining_api_port))
        mining_server.start()

        logger.info("grpc mining service - started !")

    debug_server = grpc.server(
        ThreadPoolExecutor(max_workers=config.user.debug_api_threads),
        maximum_concurrent_rpcs=config.user.debug_api_max_concurrent_rpc)
    add_DebugAPIServicer_to_server(DebugAPIService(node), debug_server)

    if config.user.debug_api_enabled:
        debug_server.add_insecure_port("{0}:{1}".format(
            config.user.debug_api_host, config.user.debug_api_port))
        debug_server.start()

        logger.info("grpc debug service - started !")

    return admin_server, public_server, mining_server, debug_server
示例#4
0
def start_services(node: QRLNode):
    server = grpc.server(ThreadPoolExecutor(max_workers=1),
                         maximum_concurrent_rpcs=config.user.max_peers_limit)
    p2p_node = P2PNode(node)

    add_BaseServicer_to_server(BaseService(node), server)
    add_P2PAPIServicer_to_server(p2p_node.service, server)
    add_PublicAPIServicer_to_server(PublicAPIService(node), server)

    server.add_insecure_port("[::]:9009")
    server.start()
    logger.debug("grpc node - started !")

    return server, p2p_node
示例#5
0
文件: services.py 项目: fanff/QRL
def start_services(node: QRLNode):
    public_server = grpc.server(ThreadPoolExecutor(max_workers=1),
                                maximum_concurrent_rpcs=config.user.max_peers_limit)
    add_BaseServicer_to_server(BaseService(node), public_server)
    add_PublicAPIServicer_to_server(PublicAPIService(node), public_server)

    public_server.add_insecure_port("[::]:9009")
    public_server.start()

    logger.info("grpc public service - started !")

    admin_server = grpc.server(ThreadPoolExecutor(max_workers=1),
                               maximum_concurrent_rpcs=config.user.max_peers_limit)
    add_AdminAPIServicer_to_server(AdminAPIService(node), admin_server)

    admin_server.add_insecure_port("127.0.0.1:9008")
    admin_server.start()

    logger.info("grpc admin service - started !")

    return admin_server, public_server