-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Add System.IO.Pipelines API #27007
Add System.IO.Pipelines API #27007
Changes from 8 commits
5573f26
dee5c34
c3a898a
4acf7f9
50713cf
2d44625
0cfbb25
1f7f6a2
792c5cd
82be16b
bb0d129
200bae7
bb72f2e
17b00a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.27325.3006 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.IO.Pipelines.Tests", "tests\System.IO.Pipelines.Tests.csproj", "{9E984EB2-827E-4029-9647-FB5F8B67C553}" | ||
ProjectSection(ProjectDependencies) = postProject | ||
{1032D5F6-5AE7-4002-A0E4-FEBEADFEA977} = {1032D5F6-5AE7-4002-A0E4-FEBEADFEA977} | ||
EndProjectSection | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.IO.Pipelines", "src\System.IO.Pipelines.csproj", "{1032D5F6-5AE7-4002-A0E4-FEBEADFEA977}" | ||
ProjectSection(ProjectDependencies) = postProject | ||
{9C524CA0-92FF-437B-B568-BCE8A794A69A} = {9C524CA0-92FF-437B-B568-BCE8A794A69A} | ||
EndProjectSection | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.IO.Pipelines", "ref\System.IO.Pipelines.csproj", "{9C524CA0-92FF-437B-B568-BCE8A794A69A}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{9E984EB2-827E-4029-9647-FB5F8B67C553}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU | ||
{9E984EB2-827E-4029-9647-FB5F8B67C553}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU | ||
{9E984EB2-827E-4029-9647-FB5F8B67C553}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU | ||
{9E984EB2-827E-4029-9647-FB5F8B67C553}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU | ||
{9C524CA0-92FF-437B-B568-BCE8A794A69A}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU | ||
{9C524CA0-92FF-437B-B568-BCE8A794A69A}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU | ||
{9C524CA0-92FF-437B-B568-BCE8A794A69A}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU | ||
{9C524CA0-92FF-437B-B568-BCE8A794A69A}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{9E984EB2-827E-4029-9647-FB5F8B67C553} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} | ||
{1032D5F6-5AE7-4002-A0E4-FEBEADFEA977} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} | ||
{9C524CA0-92FF-437B-B568-BCE8A794A69A} = {2E666815-2EDB-464B-9DF6-380BF4789AD4} | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {895BDE3D-0E51-485D-908E-16FB1A74FA64} | ||
EndGlobalSection | ||
EndGlobal |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\dir.props" /> | ||
<PropertyGroup> | ||
<AssemblyVersion>4.0.0.0</AssemblyVersion> | ||
<AssemblyKey>Open</AssemblyKey> | ||
</PropertyGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> | ||
<ItemGroup> | ||
<ProjectReference Include="..\ref\System.IO.Pipelines.csproj"> | ||
<SupportedFramework>net46;netcore50;netcoreapp1.0;$(UAPvNextTFM);$(AllXamarinFrameworks)</SupportedFramework> | ||
</ProjectReference> | ||
<ProjectReference Include="..\src\System.IO.Pipelines.csproj" /> | ||
</ItemGroup> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<BuildConfigurations> | ||
netstandard; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add netcoreapp and uap here? |
||
</BuildConfigurations> | ||
</PropertyGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
// ------------------------------------------------------------------------------ | ||
// Changes to this file must follow the http://aka.ms/api-review process. | ||
// ------------------------------------------------------------------------------ | ||
|
||
namespace System.IO.Pipelines | ||
{ | ||
public partial struct FlushResult | ||
{ | ||
private int _dummy; | ||
public FlushResult(bool isCanceled, bool isCompleted) { throw null; } | ||
public bool IsCanceled { get { throw null; } } | ||
public bool IsCompleted { get { throw null; } } | ||
} | ||
public partial interface IDuplexPipe : System.IDisposable | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets get rid of IDisposable. Not critical for this PR but we'll need to make more changes. |
||
{ | ||
System.IO.Pipelines.PipeReader Input { get; } | ||
System.IO.Pipelines.PipeWriter Output { get; } | ||
} | ||
public partial interface IPipeAwaiter<out T> | ||
{ | ||
bool IsCompleted { get; } | ||
T GetResult(); | ||
void OnCompleted(System.Action continuation); | ||
} | ||
public sealed partial class Pipe | ||
{ | ||
public Pipe() { } | ||
public Pipe(System.IO.Pipelines.PipeOptions options) { } | ||
public System.IO.Pipelines.PipeReader Reader { get { throw null; } } | ||
public System.IO.Pipelines.PipeWriter Writer { get { throw null; } } | ||
public void Reset() { } | ||
} | ||
public partial struct PipeAwaiter<T> : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion | ||
{ | ||
private object _dummy; | ||
public PipeAwaiter(System.IO.Pipelines.IPipeAwaiter<T> awaiter) { throw null; } | ||
public bool IsCompleted { get { throw null; } } | ||
public System.IO.Pipelines.PipeAwaiter<T> GetAwaiter() { throw null; } | ||
public T GetResult() { throw null; } | ||
public void OnCompleted(System.Action continuation) { } | ||
public void UnsafeOnCompleted(System.Action continuation) { } | ||
} | ||
public partial class PipeOptions | ||
{ | ||
public PipeOptions(System.Buffers.MemoryPool<byte> pool = null, System.IO.Pipelines.PipeScheduler readerScheduler = null, System.IO.Pipelines.PipeScheduler writerScheduler = null, long pauseWriterThreshold = (long)0, long resumeWriterThreshold = (long)0, int minimumSegmentSize = 2048) { } | ||
public static System.IO.Pipelines.PipeOptions Default { get { throw null; } } | ||
public int MinimumSegmentSize { get { throw null; } } | ||
public long PauseWriterThreshold { get { throw null; } } | ||
public System.Buffers.MemoryPool<byte> Pool { get { throw null; } } | ||
public System.IO.Pipelines.PipeScheduler ReaderScheduler { get { throw null; } } | ||
public long ResumeWriterThreshold { get { throw null; } } | ||
public System.IO.Pipelines.PipeScheduler WriterScheduler { get { throw null; } } | ||
} | ||
public abstract partial class PipeReader | ||
{ | ||
protected PipeReader() { } | ||
public abstract void AdvanceTo(System.SequencePosition consumed); | ||
public abstract void AdvanceTo(System.SequencePosition consumed, System.SequencePosition examined); | ||
public abstract void CancelPendingRead(); | ||
public abstract void Complete(System.Exception exception = null); | ||
public abstract void OnWriterCompleted(System.Action<System.Exception, object> callback, object state); | ||
public abstract System.IO.Pipelines.PipeAwaiter<System.IO.Pipelines.ReadResult> ReadAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); | ||
public abstract bool TryRead(out System.IO.Pipelines.ReadResult result); | ||
} | ||
public abstract partial class PipeScheduler | ||
{ | ||
protected PipeScheduler() { } | ||
public static System.IO.Pipelines.PipeScheduler Inline { get { throw null; } } | ||
public static System.IO.Pipelines.PipeScheduler ThreadPool { get { throw null; } } | ||
public abstract void Schedule(System.Action action); | ||
public abstract void Schedule(System.Action<object> action, object state); | ||
} | ||
public abstract partial class PipeWriter : System.Buffers.IBufferWriter<byte> | ||
{ | ||
protected PipeWriter() { } | ||
public abstract void Advance(int bytes); | ||
public abstract void CancelPendingFlush(); | ||
public abstract void Commit(); | ||
public abstract void Complete(System.Exception exception = null); | ||
public abstract System.IO.Pipelines.PipeAwaiter<System.IO.Pipelines.FlushResult> FlushAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); | ||
public abstract System.Memory<byte> GetMemory(int minimumLength = 0); | ||
public abstract System.Span<byte> GetSpan(int minimumLength = 0); | ||
public abstract int MaxBufferSize { get; } | ||
public abstract void OnReaderCompleted(System.Action<System.Exception, object> callback, object state); | ||
public virtual System.IO.Pipelines.PipeAwaiter<System.IO.Pipelines.FlushResult> WriteAsync(System.ReadOnlyMemory<byte> source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | ||
} | ||
public partial struct ReadResult | ||
{ | ||
private object _dummy; | ||
public ReadResult(System.Buffers.ReadOnlySequence<byte> buffer, bool isCanceled, bool isCompleted) { throw null; } | ||
public System.Buffers.ReadOnlySequence<byte> Buffer { get { throw null; } } | ||
public bool IsCanceled { get { throw null; } } | ||
public bool IsCompleted { get { throw null; } } | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. public bool IsFlush { get { throw null; } } to differentiate between |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> | ||
<PropertyGroup> | ||
<ProjectGuid>{9C524CA0-92FF-437B-B568-BCE8A794A69A}</ProjectGuid> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" /> | ||
<ItemGroup> | ||
<Compile Include="System.IO.Pipelines.cs" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard'"> | ||
<ProjectReference Include="..\..\System.Memory\ref\System.Memory.csproj" /> | ||
<ProjectReference Include="..\..\System.Buffers\ref\System.Buffers.csproj" /> | ||
</ItemGroup> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<BuildConfigurations> | ||
netstandard; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to add netstandard1.3 and netcoreapp here (and add corresponding PropertyGroup in the csproj as well). See https://github.com/dotnet/corefx/blob/master/src/System.Memory/src/System.Memory.csproj#L13-L22 |
||
</BuildConfigurations> | ||
</PropertyGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("System.IO.Pipelines.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should avoid this. If tests need to extract internals (and this practice should be used with discretion), it should use Reflection to get just what's needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really? The ASP.NET uses this pattern for tests all the time. In fact thats the only valid use of internals visible to IMO. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we need the following tags:
cc @weshaggard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No you don't need those tags. This library is supposed to ship as a nuget package and not in the shared frameworks.