Show / Hide Table of Contents

Class AsyncQldbDriver

Represents a factory for accessing a specific ledger within QLDB. This class or QldbDriver should be the main entry points to any interaction with QLDB.

This factory pools sessions and attempts to return unused but available sessions when getting new sessions. The pool does not remove stale sessions until a new session is retrieved. The default pool size is the maximum amount of connections the session client allows set in the . Dispose() should be called when this factory is no longer needed in order to clean up resources, ending all sessions in the pool.

Inheritance
System.Object
AsyncQldbDriver
Implements
IAsyncQldbDriver
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Amazon.QLDB.Driver
Assembly: Amazon.QLDB.Driver.dll
Syntax
public class AsyncQldbDriver : IAsyncQldbDriver, IDisposable

Methods

| Improve this Doc View Source

Builder()

Retrieve a builder object for creating a AsyncQldbDriver.

Declaration
public static AsyncQldbDriverBuilder Builder()
Returns
Type Description
AsyncQldbDriverBuilder

The builder object for creating a AsyncQldbDriver.

| Improve this Doc View Source

Dispose()

Close this driver and end all sessions in the current pool. No-op if already closed.

Declaration
public void Dispose()
| Improve this Doc View Source

Execute(Func<AsyncTransactionExecutor, Task>, RetryPolicy, CancellationToken)

Execute the Async Executor lambda against QLDB within a transaction where no result is expected.

Declaration
public async Task Execute(Func<AsyncTransactionExecutor, Task> action, RetryPolicy retryPolicy, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Func<AsyncTransactionExecutor, System.Threading.Tasks.Task> action

The Async Executor lambda with no return value representing the block of code to be executed within the transaction. This cannot have any side effects as it may be invoked multiple times.

RetryPolicy retryPolicy

A RetryPolicy that overrides the RetryPolicy set when creating the driver. The given retry policy will be used when retrying the transaction.

System.Threading.CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
System.Threading.Tasks.Task

No object or value is returned by this method when it completes.

Exceptions
Type Condition
TransactionAbortedException

Thrown if the Executor lambda calls Abort().

QldbDriverException

Thrown when called on a disposed instance.

Amazon.Runtime.AmazonServiceException

Thrown when there is an error executing against QLDB.

| Improve this Doc View Source

Execute(Func<AsyncTransactionExecutor, Task>, CancellationToken)

Execute the Async Executor lambda against QLDB within a transaction where no result is expected.

Declaration
public async Task Execute(Func<AsyncTransactionExecutor, Task> action, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Func<AsyncTransactionExecutor, System.Threading.Tasks.Task> action

The Async Executor lambda with no return value representing the block of code to be executed within the transaction. This cannot have any side effects as it may be invoked multiple times.

System.Threading.CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
System.Threading.Tasks.Task

No object or value is returned by this method when it completes.

Exceptions
Type Condition
TransactionAbortedException

Thrown if the Executor lambda calls Abort().

QldbDriverException

Thrown when called on a disposed instance.

Amazon.Runtime.AmazonServiceException

Thrown when there is an error executing against QLDB.

| Improve this Doc View Source

Execute<T>(Func<AsyncTransactionExecutor, Task<T>>, RetryPolicy, CancellationToken)

Execute the Async Executor lambda against QLDB and retrieve the result within a transaction.

Declaration
public async Task<T> Execute<T>(Func<AsyncTransactionExecutor, Task<T>> func, RetryPolicy retryPolicy, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Func<AsyncTransactionExecutor, System.Threading.Tasks.Task<T>> func

The Async Executor lambda representing the block of code to be executed within the transaction. This cannot have any side effects as it may be invoked multiple times, and the result cannot be trusted until the transaction is committed.

RetryPolicy retryPolicy

A RetryPolicy that overrides the RetryPolicy set when creating the driver. The given retry policy will be used when retrying the transaction.

System.Threading.CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
System.Threading.Tasks.Task<T>

The Task containing return value of executing the executor. Note that if you directly return a IAsyncResult, this will be automatically buffered in memory before the implicit commit to allow reading, as the commit will close any open results. Any other IAsyncResult instances created within the executor block will be invalidated, including if the return value is an object which nests said IAsyncResult instances within it.

Type Parameters
Name Description
T

The return type.

Exceptions
Type Condition
TransactionAbortedException

Thrown if the Executor lambda calls Abort().

QldbDriverException

Thrown when called on a disposed instance.

Amazon.Runtime.AmazonServiceException

Thrown when there is an error executing against QLDB.

| Improve this Doc View Source

Execute<T>(Func<AsyncTransactionExecutor, Task<T>>, CancellationToken)

Execute the Async Executor lambda against QLDB and retrieve the result within a transaction.

Declaration
public async Task<T> Execute<T>(Func<AsyncTransactionExecutor, Task<T>> func, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Func<AsyncTransactionExecutor, System.Threading.Tasks.Task<T>> func

The Async Executor lambda representing the block of code to be executed within the transaction. This cannot have any side effects as it may be invoked multiple times, and the result cannot be trusted until the transaction is committed.

System.Threading.CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
System.Threading.Tasks.Task<T>

The Task containing return value of executing the executor. Note that if you directly return a IAsyncResult, this will be automatically buffered in memory before the implicit commit to allow reading, as the commit will close any open results. Any other IAsyncResult instances created within the executor block will be invalidated, including if the return value is an object which nests said IAsyncResult instances within it.

Type Parameters
Name Description
T

The return type.

Exceptions
Type Condition
TransactionAbortedException

Thrown if the Executor lambda calls Abort().

QldbDriverException

Thrown when called on a disposed instance.

Amazon.Runtime.AmazonServiceException

Thrown when there is an error executing against QLDB.

| Improve this Doc View Source

ListTableNames(CancellationToken)

Retrieve the table names that are available within the ledger.

Declaration
public async Task<IEnumerable<string>> ListTableNames(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.String>>

The task Enumerable containing the table names in the ledger.

Implements

IAsyncQldbDriver
System.IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX