/// <summary>EXPERIMENTAL</summary> public Task WriteAsync([InstantHandle] Func <IFdbTransaction, Task> handler, [InstantHandle] Func <IFdbTransaction, Task> success, CancellationToken ct) { //REVIEW: right now, nothing prevents the lambda from calling read methods on the transaction, making this equivalent to calling ReadWriteAsync() // => this version of WriteAsync is only there to catch mistakes when someones passes in an async lambda, instead of an Action<IFdbTransaction> //TODO: have a "WriteOnly" mode on transaction to forbid doing any reads ? return(FdbOperationContext.RunWriteAsync(this, handler, success, ct)); }
/// <summary>EXPERIMENTAL</summary> public Task ReadWriteAsync([InstantHandle] Func <IFdbTransaction, Task> handler, [InstantHandle] Action <IFdbTransaction> success, CancellationToken ct) { return(FdbOperationContext.RunWriteAsync(this, handler, success, ct)); }
/// <summary>Runs a transactional lambda function against this database, inside a read-write transaction context, with retry logic.</summary> /// <param name="state">State that will be passed back to the <paramref name="handler"/></param> /// <param name="handler">Asynchronous lambda function that is passed a new read-write transaction on each retry.</param> /// <param name="ct">Optional cancellation token that will be passed to the transaction context, and that can also be used to abort the retry loop.</param> public Task ReadWriteAsync <TState>(TState state, [InstantHandle] Func <IFdbTransaction, TState, Task> handler, CancellationToken ct) { Contract.NotNull(handler, nameof(handler)); return(FdbOperationContext.RunWriteAsync(this, (tr) => handler(tr, state), ct)); }
/// <summary>Runs a transactional lambda function against this database, inside a write-only transaction context, with retry logic.</summary> /// <param name="state">State that will be passed back to the <paramref name="handler"/></param> /// <param name="handler">Lambda function that is passed a new read-write transaction on each retry. It should only call non-async methods, such as Set, Clear or any atomic operation.</param> /// <param name="ct">Optional cancellation token that will be passed to the transaction context, and that can also be used to abort the retry loop.</param> public Task WriteAsync <TState>(TState state, [InstantHandle] Action <IFdbTransaction, TState> handler, CancellationToken ct) { return(FdbOperationContext.RunWriteAsync(this, (tr) => handler(tr, state), ct)); }
/// <summary>Runs a transactional lambda function against this database, inside a write-only transaction context, with retry logic.</summary> /// <param name="handler">Lambda function that is passed a new read-write transaction on each retry. It should only call non-async methods, such as Set, Clear or any atomic operation.</param> /// <param name="ct">Optional cancellation token that will be passed to the transaction context, and that can also be used to abort the retry loop.</param> public Task WriteAsync([InstantHandle] Action <IFdbTransaction> handler, CancellationToken ct) { return(FdbOperationContext.RunWriteAsync(this, handler, ct)); }
/// <summary>EXPERIMENTAL</summary> public Task ReadWriteAsync([InstantHandle] Func <IFdbTransaction, Task> asyncHandler, [InstantHandle] Action <IFdbTransaction> onDone, CancellationToken cancellationToken) { return(FdbOperationContext.RunWriteAsync(this, asyncHandler, onDone, cancellationToken)); }
/// <summary>Runs a transactional lambda function against this database, inside a read-write transaction context, with retry logic.</summary> /// <param name="asyncHandler">Asynchronous lambda function that is passed a new read-write transaction on each retry.</param> /// <param name="ct">Optional cancellation token that will be passed to the transaction context, and that can also be used to abort the retry loop.</param> public Task ReadWriteAsync([InstantHandle] Func <IFdbTransaction, Task> asyncHandler, CancellationToken ct) { return(FdbOperationContext.RunWriteAsync(this, asyncHandler, null, ct)); }