Rename StreamPipeReaderOptions to StreamPipeReaderAdapterOptions (#9177)

This commit is contained in:
Justin Kotalik 2019-04-09 17:05:44 -07:00 committed by Andrew Stanton-Nurse
parent 3e1b1ac4e0
commit 0378cbbc51
6 changed files with 15 additions and 15 deletions

View File

@ -523,7 +523,7 @@ namespace System.IO.Pipelines
public partial class StreamPipeReader : System.IO.Pipelines.PipeReader, System.IDisposable public partial class StreamPipeReader : System.IO.Pipelines.PipeReader, System.IDisposable
{ {
public StreamPipeReader(System.IO.Stream readingStream) { } public StreamPipeReader(System.IO.Stream readingStream) { }
public StreamPipeReader(System.IO.Stream readingStream, System.IO.Pipelines.StreamPipeReaderOptions options) { } public StreamPipeReader(System.IO.Stream readingStream, System.IO.Pipelines.StreamPipeReaderAdapterOptions options) { }
public System.IO.Stream InnerStream { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public System.IO.Stream InnerStream { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public override void AdvanceTo(System.SequencePosition consumed) { } public override void AdvanceTo(System.SequencePosition consumed) { }
public override void AdvanceTo(System.SequencePosition consumed, System.SequencePosition examined) { } public override void AdvanceTo(System.SequencePosition consumed, System.SequencePosition examined) { }
@ -535,13 +535,13 @@ namespace System.IO.Pipelines
public override System.Threading.Tasks.ValueTask<System.IO.Pipelines.ReadResult> ReadAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask<System.IO.Pipelines.ReadResult> ReadAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override bool TryRead(out System.IO.Pipelines.ReadResult result) { throw null; } public override bool TryRead(out System.IO.Pipelines.ReadResult result) { throw null; }
} }
public partial class StreamPipeReaderOptions public partial class StreamPipeReaderAdapterOptions
{ {
public const int DefaultMinimumReadThreshold = 256; public const int DefaultMinimumReadThreshold = 256;
public const int DefaultMinimumSegmentSize = 4096; public const int DefaultMinimumSegmentSize = 4096;
public static System.IO.Pipelines.StreamPipeReaderOptions DefaultOptions; public static System.IO.Pipelines.StreamPipeReaderAdapterOptions DefaultOptions;
public StreamPipeReaderOptions() { } public StreamPipeReaderAdapterOptions() { }
public StreamPipeReaderOptions(int minimumSegmentSize, int minimumReadThreshold, System.Buffers.MemoryPool<byte> memoryPool) { } public StreamPipeReaderAdapterOptions(int minimumSegmentSize, int minimumReadThreshold, System.Buffers.MemoryPool<byte> memoryPool) { }
public System.Buffers.MemoryPool<byte> MemoryPool { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public System.Buffers.MemoryPool<byte> MemoryPool { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public int MinimumReadThreshold { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public int MinimumReadThreshold { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public int MinimumSegmentSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public int MinimumSegmentSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }

View File

@ -37,7 +37,7 @@ namespace System.IO.Pipelines
/// </summary> /// </summary>
/// <param name="readingStream">The stream to read from.</param> /// <param name="readingStream">The stream to read from.</param>
public StreamPipeReader(Stream readingStream) public StreamPipeReader(Stream readingStream)
: this(readingStream, StreamPipeReaderOptions.DefaultOptions) : this(readingStream, StreamPipeReaderAdapterOptions.DefaultOptions)
{ {
} }
@ -46,7 +46,7 @@ namespace System.IO.Pipelines
/// </summary> /// </summary>
/// <param name="readingStream">The stream to read from.</param> /// <param name="readingStream">The stream to read from.</param>
/// <param name="options">The options to use.</param> /// <param name="options">The options to use.</param>
public StreamPipeReader(Stream readingStream, StreamPipeReaderOptions options) public StreamPipeReader(Stream readingStream, StreamPipeReaderAdapterOptions options)
{ {
InnerStream = readingStream ?? throw new ArgumentNullException(nameof(readingStream)); InnerStream = readingStream ?? throw new ArgumentNullException(nameof(readingStream));

View File

@ -8,17 +8,17 @@ using System.Text;
namespace System.IO.Pipelines namespace System.IO.Pipelines
{ {
public class StreamPipeReaderOptions public class StreamPipeReaderAdapterOptions
{ {
public static StreamPipeReaderOptions DefaultOptions = new StreamPipeReaderOptions(); public static StreamPipeReaderAdapterOptions DefaultOptions = new StreamPipeReaderAdapterOptions();
public const int DefaultMinimumSegmentSize = 4096; public const int DefaultMinimumSegmentSize = 4096;
public const int DefaultMinimumReadThreshold = 256; public const int DefaultMinimumReadThreshold = 256;
public StreamPipeReaderOptions() public StreamPipeReaderAdapterOptions()
{ {
} }
public StreamPipeReaderOptions(int minimumSegmentSize, int minimumReadThreshold, MemoryPool<byte> memoryPool) public StreamPipeReaderAdapterOptions(int minimumSegmentSize, int minimumReadThreshold, MemoryPool<byte> memoryPool)
{ {
MinimumSegmentSize = minimumSegmentSize; MinimumSegmentSize = minimumSegmentSize;
MinimumReadThreshold = minimumReadThreshold; MinimumReadThreshold = minimumReadThreshold;

View File

@ -532,7 +532,7 @@ namespace System.IO.Pipelines.Tests
public void SetMinimumReadThresholdOfZeroThrows() public void SetMinimumReadThresholdOfZeroThrows()
{ {
Assert.Throws<ArgumentOutOfRangeException>(() => new StreamPipeReader(Stream, Assert.Throws<ArgumentOutOfRangeException>(() => new StreamPipeReader(Stream,
new StreamPipeReaderOptions(minimumSegmentSize: 4096, minimumReadThreshold: 0, new TestMemoryPool()))); new StreamPipeReaderAdapterOptions(minimumSegmentSize: 4096, minimumReadThreshold: 0, new TestMemoryPool())));
} }
[Fact] [Fact]
@ -686,7 +686,7 @@ namespace System.IO.Pipelines.Tests
private void CreateReader(int minimumSegmentSize = 16, int minimumReadThreshold = 4, MemoryPool<byte> memoryPool = null) private void CreateReader(int minimumSegmentSize = 16, int minimumReadThreshold = 4, MemoryPool<byte> memoryPool = null)
{ {
Reader = new StreamPipeReader(Stream, Reader = new StreamPipeReader(Stream,
new StreamPipeReaderOptions( new StreamPipeReaderAdapterOptions(
minimumSegmentSize, minimumSegmentSize,
minimumReadThreshold, minimumReadThreshold,
memoryPool ?? new TestMemoryPool())); memoryPool ?? new TestMemoryPool()));

View File

@ -24,7 +24,7 @@ namespace System.IO.Pipelines.Tests
Pool = new TestMemoryPool(); Pool = new TestMemoryPool();
Stream = new MemoryStream(); Stream = new MemoryStream();
Writer = new StreamPipeWriter(Stream, MinimumSegmentSize, Pool); Writer = new StreamPipeWriter(Stream, MinimumSegmentSize, Pool);
Reader = new StreamPipeReader(Stream, new StreamPipeReaderOptions(MinimumSegmentSize, minimumReadThreshold: 256, Pool)); Reader = new StreamPipeReader(Stream, new StreamPipeReaderAdapterOptions(MinimumSegmentSize, minimumReadThreshold: 256, Pool));
} }
public void Dispose() public void Dispose()

View File

@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
set set
{ {
RequestBody = value; RequestBody = value;
var requestPipeReader = new StreamPipeReader(RequestBody, new StreamPipeReaderOptions( var requestPipeReader = new StreamPipeReader(RequestBody, new StreamPipeReaderAdapterOptions(
minimumSegmentSize: KestrelMemoryPool.MinimumSegmentSize, minimumSegmentSize: KestrelMemoryPool.MinimumSegmentSize,
minimumReadThreshold: KestrelMemoryPool.MinimumSegmentSize / 4, minimumReadThreshold: KestrelMemoryPool.MinimumSegmentSize / 4,
_context.MemoryPool)); _context.MemoryPool));