export function openLedger()

in src/core/session.ts [31:59]


export function openLedger(ledgerName: string) {
  const maxConcurrentTransactions: number = 10;
  const agentForQldb: Agent = new Agent({
    keepAlive: true,
    maxSockets: maxConcurrentTransactions,
    rejectUnauthorized: false, // Don't do this
  });

  const getServiceConfig = () =>
    sessionEndpointValue
      ? {
          httpOptions: { agent: agentForQldb },
          endpoint: sessionEndpointValue,
        }
      : { httpOptions: { agent: agentForQldb } };

  const retryLimit: number = 4;
  // Use driver's default backoff function for this example (no second parameter provided to RetryConfig)
  const retryConfig: RetryConfig = new RetryConfig(retryLimit);
  const driver = new QldbDriver(
    ledgerName,
    getServiceConfig(),
    maxConcurrentTransactions,
    retryConfig
  );
  return {
    execute: executeStatement(driver),
  };
}