def sdk_pool_handle(looper, txnPoolNodeSet, tdirWithPoolTxns, sdk_pool_name): pool_handle = looper.loop.run_until_complete( _gen_pool_handler(tdirWithPoolTxns, sdk_pool_name)) yield pool_handle try: looper.loop.run_until_complete(close_pool_ledger(pool_handle)) except Exception as e: logger.debug("Unhandled exception: {}".format(e))
def sdk_pool_handle(looper, txnPoolNodeSet, tdirWithPoolTxns, sdk_pool_data): sdk_set_protocol_version(looper) pool_name, open_config = sdk_pool_data pool_handle = looper.loop.run_until_complete( _gen_pool_handler(tdirWithPoolTxns, pool_name, open_config)) yield pool_handle try: looper.loop.run_until_complete(close_pool_ledger(pool_handle)) except Exception as e: logger.debug("Unhandled exception: {}".format(e))
def sdk_pool_handle(looper, txnPoolNodeSet, tdirWithPoolTxns, sdk_pool_data): # TODO think about moving protocol version setting to separate # fixture like 'sdk_init' since some sdk request builders don't # requires pool handle but use protocol version sdk_set_protocol_version(looper) pool_name, open_config = sdk_pool_data pool_handle = looper.loop.run_until_complete( _gen_pool_handler(tdirWithPoolTxns, pool_name, open_config)) yield pool_handle try: looper.loop.run_until_complete(close_pool_ledger(pool_handle)) except Exception as e: logger.debug("Unhandled exception: {}".format(e))
def check_genesis(gen_path): loop = asyncio.get_event_loop() pool_cfg = json.dumps({"genesis_txn": gen_path}) pool_name = "pool_{}".format(random_string(24)) loop.run_until_complete(pool.set_protocol_version(2)) try: loop.run_until_complete( pool.create_pool_ledger_config(pool_name, pool_cfg)) pool_handle = loop.run_until_complete( pool.open_pool_ledger(pool_name, None)) except Exception as ex: raise argparse.ArgumentTypeError(ex) loop.run_until_complete(pool.close_pool_ledger(pool_handle)) dir_to_dlt = os.path.join(os.path.expanduser("~/.indy_client/pool"), pool_name) if os.path.isdir(dir_to_dlt): shutil.rmtree(dir_to_dlt, ignore_errors=True)
def pool_handle(event_loop, pool_name, pool_config, pool_handle_cleanup): logger = logging.getLogger(__name__) logger.debug("pool_handle: >>> pool_name: %r, pool_config: %r, pool_handle_cleanup: %r", pool_name, pool_config, pool_handle_cleanup) logger.debug("pool_handle: Opening pool ledger") pool_handle = event_loop.run_until_complete(pool.open_pool_ledger(pool_name, pool_config)) assert type(pool_handle) is int logger.debug("pool_handle: yield: %r", pool_handle) yield pool_handle logger.debug("pool_handle: Closing pool ledger") event_loop.run_until_complete(pool.close_pool_ledger(pool_handle)) if pool_handle_cleanup else None logger.debug("pool_handle: <<<")
def pool_handle(event_loop, pool_name, pool_ledger_config, pool_config, pool_handle_cleanup, protocol_version): logger = logging.getLogger(__name__) logger.debug("pool_handle: >>> pool_name: %r, pool_ledger_config: %r, pool_config: %r, pool_handle_cleanup: %r," " protocol_version: %r", pool_name, pool_ledger_config, pool_config, pool_handle_cleanup, protocol_version) logger.debug("pool_handle: Opening pool ledger") pool_handle = event_loop.run_until_complete(pool.open_pool_ledger(pool_name, pool_config)) assert type(pool_handle) is int logger.debug("pool_handle: yield: %r", pool_handle) yield pool_handle logger.debug("pool_handle: Closing pool ledger") event_loop.run_until_complete(pool.close_pool_ledger(pool_handle)) if pool_handle_cleanup else None logger.debug("pool_handle: <<<")
con_resp_enc_b64 = base64.b64encode(con_resp_enc).decode('utf-8') return con, con_resp_enc_b64 loop = asyncio.get_event_loop() pool_handle = loop.run_until_complete( create_and_open_pool(pool_name, pool_genesis_txn_path)) agent = Agent(pool_handle, wallet_name, wallet_key) with ServerProxy(endpoint) as proxy: print('\nCalling request_connection()') con_req = proxy.request_connection() print('Recieved connection request:') pp(con_req) print('\n') connection, con_resp = loop.run_until_complete(process_request(con_req)) print("Calling authenticate_connection(" + connection.name + ", <encrypted>)") authenticated = proxy.authenticate_connection(connection.name, con_resp) print("Recieved authentication status:") pp(authenticated) loop.run_until_complete(pool.close_pool_ledger(pool_handle)) loop.close()
def sdk_pool_handle(looper, txnPoolNodeSet, tdirWithPoolTxns, sdk_pool_name): pool_handle = looper.loop.run_until_complete( _gen_pool_handler(tdirWithPoolTxns, sdk_pool_name)) yield pool_handle looper.loop.run_until_complete(close_pool_ledger(pool_handle))
def pool_handle(pool_ledger_created, pool_name, event_loop): pool_handle = event_loop.run_until_complete( pool.open_pool_ledger(pool_name, None)) yield pool_handle event_loop.run_until_complete(pool.close_pool_ledger(pool_handle))