Example #1
0
        /// <see cref="WriteAsync(IWriteOnlyStore,Stream,int,CancellationToken)"/>
        private static async Task <byte[]> InternalWrite(StoreWriter writer, byte[] buffer, int count, bool thenCommit, CancellationToken cancel)
        {
            // This method returns the byte array to facilitate the control flow.
            // This way, the byte array is reserved until the write task completes.

            if (thenCommit)
            {
                await writer.WriteAndCommitAsync(buffer, 0, count, cancel);
            }
            else
            {
                await writer.WriteAsync(buffer, 0, count, cancel);
            }

            return(buffer);
        }
Example #2
0
 /// <see cref="Stream.WriteAsync(byte[],int,int,CancellationToken)"/>
 public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancel) =>
 _w.WriteAsync(buffer, offset, count, cancel);