예제 #1
0
def main(private_key: PrivateKey, state_db: str, matrix_server: List[str],
         accept_disclaimer: bool) -> int:
    """The request collector for the monitoring service."""
    log.info("Starting Raiden Monitoring Request Collector")
    click.secho(MS_DISCLAIMER, fg="yellow")
    if not accept_disclaimer:
        click.confirm(CONFIRMATION_OF_UNDERSTANDING, abort=True)
    if state_db != ":memory:" and not os.path.exists(state_db):
        log.error(
            "Database file from monitoring service not found. Is the monitoring service running?",
            expected_db_path=state_db,
        )
        sys.exit(1)

    database = SharedDatabase(state_db)

    service = RequestCollector(private_key=private_key,
                               state_db=database,
                               matrix_servers=matrix_server)

    service.start()
    service.listen_forever()

    print("Exiting...")
    return 0
예제 #2
0
def request_collector(ms_address, ms_database, get_private_key):
    with patch("request_collector.server.MatrixListener"):
        rc = RequestCollector(private_key=get_private_key(ms_address), state_db=ms_database)
        rc.start()
        yield rc
        rc.stop()
        rc.join()
예제 #3
0
def main(private_key: str, state_db: str) -> int:
    """ The request collector for the monitoring service. """
    log.info("Starting Raiden Monitoring Request Collector")

    database = SharedDatabase(state_db)

    RequestCollector(private_key=private_key, state_db=database).listen_forever()

    print('Exiting...')
    return 0
예제 #4
0
def request_collector(
    server_private_key,
    ms_database,
    web3,
    monitoring_service_contract,
    token_network_registry_contract,
    send_funds,
    contracts_manager: ContractManager,
):
    with patch('request_collector.server.MatrixListener'):
        rc = RequestCollector(private_key=server_private_key,
                              state_db=ms_database)
        rc.start()
        yield rc
        rc.stop()
        rc.join()
예제 #5
0
def main(
    monitoring_channel: str,
    matrix_homeserver: str,
    matrix_username: str,
    matrix_password: str,
    state_db: str,
    log_level: str,
    log_config: TextIO,
):
    """Console script for request_collector.

    Logging can be quickly set by specifying a global log level or in a
    detailed way by using a log configuration file. See
    https://docs.python.org/3.7/library/logging.config.html#logging-config-dictschema
    for a detailed description of the format.
    """
    assert log_config is None
    setup_logging(log_level, log_config)

    log.info("Starting Raiden Monitoring Request Collector")

    transport = MatrixTransport(
        matrix_homeserver,
        matrix_username,
        matrix_password,
        monitoring_channel,
    )

    database = StateDBSqlite(state_db)

    service = None
    try:
        service = RequestCollector(
            state_db=database,
            transport=transport,
        )

        service.run()
    except (KeyboardInterrupt, SystemExit):
        print('Exiting...')
    finally:
        log.info('Stopping Pathfinding Service...')
        if service:
            service.stop()

    return 0
예제 #6
0
def request_collector(
    server_private_key,
    blockchain,
    dummy_transport,
    state_db_sqlite,
    web3,
    monitoring_service_contract,
    token_network_registry_contract,
    send_funds,
    contracts_manager: ContractManager,
):
    rc = RequestCollector(
        state_db=state_db_sqlite,
        transport=dummy_transport,
    )
    rc.start()
    yield rc
    rc.stop()
예제 #7
0
def main(private_key: str, state_db: str) -> int:
    """ The request collector for the monitoring service. """
    log.info("Starting Raiden Monitoring Request Collector")

    if state_db != ":memory:" and not os.path.exists(state_db):
        log.error(
            "Database file from monitoring service not found. Is the monitoring service running?",
            expected_db_path=state_db,
        )
        sys.exit(1)

    database = SharedDatabase(state_db)

    service = RequestCollector(private_key=private_key, state_db=database)

    service.start()
    service.listen_forever()

    print("Exiting...")
    return 0
예제 #8
0
def main(
    keystore_file: str,
    password: str,
    state_db: str,
    log_level: str,
):
    """Console script for request_collector.

    Logging can be quickly set by specifying a global log level or in a
    detailed way by using a log configuration file. See
    https://docs.python.org/3.7/library/logging.config.html#logging-config-dictschema
    for a detailed description of the format.
    """
    setup_logging(log_level)

    with open(keystore_file, 'r') as keystore:
        try:
            private_key = Account.decrypt(
                keyfile_json=json.load(keystore),
                password=password,
            )
        except ValueError:
            log.critical(
                'Could not decode keyfile with given password. Please try again.'
            )
            sys.exit(1)

    log.info("Starting Raiden Monitoring Request Collector")

    database = SharedDatabase(state_db)

    RequestCollector(
        private_key=encode_hex(private_key),
        state_db=database,
    ).listen_forever()

    print('Exiting...')
    return 0