Interface IAsyncQldbDriver
Interface for the Async QLDB driver.
Inherited Members
Namespace: Amazon.QLDB.Driver
Assembly: Amazon.QLDB.Driver.dll
Syntax
public interface IAsyncQldbDriver : IDisposable
Methods
| Improve this Doc View SourceExecute(Func<AsyncTransactionExecutor, Task>, RetryPolicy, CancellationToken)
Execute the Async Executor lambda against QLDB within a transaction where no result is expected.
Declaration
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. |
Execute(Func<AsyncTransactionExecutor, Task>, CancellationToken)
Execute the Async Executor lambda against QLDB within a transaction where no result is expected.
Declaration
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. |
Execute<T>(Func<AsyncTransactionExecutor, Task<T>>, RetryPolicy, CancellationToken)
Execute the Async Executor lambda against QLDB and retrieve the result within a transaction.
Declaration
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. |
Execute<T>(Func<AsyncTransactionExecutor, Task<T>>, CancellationToken)
Execute the Async Executor lambda against QLDB and retrieve the result within a transaction.
Declaration
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. |
ListTableNames(CancellationToken)
Retrieve the table names that are available within the ledger.
Declaration
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. |