IFdbReadOnlyRetryable
Namespace: FoundationDB.Client · interface
Transactional context that can execute, inside a retry loop, idempotent actions using read-only transactions.
Methods
ReadAsync
Task ReadAsync(Func<IFdbReadOnlyTransaction, Task> handler, CancellationToken ct)
Runs an idempotent transaction block inside a read-only transaction, which can be executed more than once if any retryable error occurs.
handler— Idempotent handler that will only read from the database, and may be retried if a recoverable error occurs.ct— Token used to cancel the operation
Returns: Task that succeeds if no error occurred during execution of handler.
Since the method does not result any result, it should only be used to verify the content of the database. Any attempt to write or commit using the transaction will throw. Given that the can run more than once, and that there is no guarantee that the transaction commits once it returns, you MUST NOT mutate any global state (counters, cache, global dictionary) inside this lambda! You must wait for the Task to complete successfully before updating the global state of the application.
Task<TResult> ReadAsync<TResult>(Func<IFdbReadOnlyTransaction, Task<TResult>> handler, CancellationToken ct)
Runs an idempotent transaction block inside a read-only transaction, which can be executed more than once if any retryable error occurs.
handler— Idempotent handler that will only read from the database, and may be retried if a recoverable error occurs.ct— Token used to cancel the operation
Returns: Result of the last successful execution of handler.
Any attempt to write or commit using the transaction will throw. Given that the can run more than once, and that there is no guarantee that the transaction commits once it returns, you MUST NOT mutate any global state (counters, cache, global dictionary) inside this lambda! You must wait for the Task to complete successfully before updating the global state of the application.
Task ReadAsync<TState>(TState state, Func<IFdbReadOnlyTransaction, TState, Task> handler, CancellationToken ct)
Runs an idempotent transaction block inside a read-only transaction, which can be executed more than once if any retryable error occurs.
state— Caller-provided context or state that will be passed through to thehandlerhandler— Idempotent handler that will only read from the database, and may be retried if a recoverable error occurs.ct— Token used to cancel the operation
Returns: Task that succeeds if no error occurred during execution of handler.
Since the method does not result any result, it should only be used to verify the content of the database. Any attempt to write or commit using the transaction will throw. Given that the can run more than once, and that there is no guarantee that the transaction commits once it returns, you MUST NOT mutate any global state (counters, cache, global dictionary) inside this lambda! You must wait for the Task to complete successfully before updating the global state of the application.
Task<TResult> ReadAsync<TState, TResult>(TState state, Func<IFdbReadOnlyTransaction, TState, Task<TResult>> handler, CancellationToken ct)
Runs an idempotent transaction block inside a read-only transaction, which can be executed more than once if any retryable error occurs.
state— Caller-provided context or state that will be passed through to thehandlerhandler— Idempotent handler that will only read from the database, and may be retried if a recoverable error occurs.ct— Token used to cancel the operation
Returns: Result of the last successful execution of handler.
Any attempt to write or commit using the transaction will throw. Given that the can run more than once, and that there is no guarantee that the transaction commits once it returns, you MUST NOT mutate any global state (counters, cache, global dictionary) inside this lambda! You must wait for the Task to complete successfully before updating the global state of the application.
Task<TResult> ReadAsync<TResult>(Func<IFdbReadOnlyTransaction, Task<TResult>> handler, Action<IFdbReadOnlyTransaction, TResult> success, CancellationToken ct)
Runs an idempotent transaction block inside a read-only transaction, which can be executed more than once if any retryable error occurs.
handler— Idempotent handler that will only read from the database, and may be retried if a recoverable error occurs.success— Handler that will be called once the transaction executes successfully. The result from the last invocation ofhandlerwill be passed as the second parameter.ct— Token used to cancel the operation
Returns: Result of the last successful execution of handler.
Any attempt to write or commit using the transaction will throw. Given that the can run more than once, and that there is no guarantee that the transaction commits once it returns, you MUST NOT mutate any global state (counters, cache, global dictionary) inside this lambda! You must wait for the Task to complete successfully before updating the global state of the application.
Task<TResult> ReadAsync<TIntermediate, TResult>(Func<IFdbReadOnlyTransaction, Task<TIntermediate>> handler, Func<IFdbReadOnlyTransaction, TIntermediate, TResult> success, CancellationToken ct)
Runs an idempotent transaction block inside a read-only transaction, which can be executed more than once if any retryable error occurs.
handler— Idempotent handler that will only read from the database, and may be retried if a recoverable error occurs.success— Handler that will be called once the transaction executes successfully. The result from the last invocation ofhandlerwill be passed as the second parameter.ct— Token used to cancel the operation
Returns: Result return by success, if it was called.
Any attempt to write or commit using the transaction will throw. Given that the can run more than once, and that there is no guarantee that the transaction commits once it returns, you MUST NOT mutate any global state (counters, cache, global dictionary) inside this lambda! You must wait for the Task to complete successfully before updating the global state of the application.
Task<TResult> ReadAsync<TIntermediate, TResult>(Func<IFdbReadOnlyTransaction, Task<TIntermediate>> handler, Func<IFdbReadOnlyTransaction, TIntermediate, Task<TResult>> success, CancellationToken ct)
Runs an idempotent transaction block inside a read-only transaction, which can be executed more than once if any retryable error occurs.
handler— Idempotent handler that will only read from the database, and may be retried if a recoverable error occurs.success— Handler that will be called once the transaction executes successfully. The result from the last invocation ofhandlerwill be passed as the second parameter.ct— Token used to cancel the operation
Returns: Result return by success, if it was called.
Any attempt to write or commit using the transaction will throw. Given that the can run more than once, and that there is no guarantee that the transaction commits once it returns, you MUST NOT mutate any global state (counters, cache, global dictionary) inside this lambda! You must wait for the Task to complete successfully before updating the global state of the application.
Task<TResult> ReadAsync<TState, TIntermediate, TResult>(TState state, Func<IFdbReadOnlyTransaction, TState, Task<TIntermediate>> handler, Func<IFdbReadOnlyTransaction, TIntermediate, Task<TResult>> success, CancellationToken ct)
Runs an idempotent transaction block inside a read-only transaction, which can be executed more than once if any retryable error occurs.
state— Caller-provided context or state that will be passed through to thehandlerhandler— Idempotent handler that will only read from the database, and may be retried if a recoverable error occurs.success— Handler that will be called once the transaction executes successfully. The result from the last invocation ofhandlerwill be passed as the second parameter.ct— Token used to cancel the operation
Returns: Result return by success, if it was called.
Any attempt to write or commit using the transaction will throw. Given that the can run more than once, and that there is no guarantee that the transaction commits once it returns, you MUST NOT mutate any global state (counters, cache, global dictionary) inside this lambda! You must wait for the Task to complete successfully before updating the global state of the application.