Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename new Stream.Read/Write{Async} Span/Memory arguments to buffer #23889

Closed
stephentoub opened this issue Oct 18, 2017 · 6 comments
Closed
Assignees
Milestone

Comments

@stephentoub
Copy link
Member

We'd previously decided to name these source/destination, but we also have an overriding principle that we should adhere to names used in existing overloads if possible, and we should only use source/destination to help in cases where we need to make the direction clear. Thus we should update the names in these new overloads before we ship them.

@ghost ghost assigned ghost and unassigned ghost Feb 12, 2018
@JeremyKuhne
Copy link
Member

@stephentoub Presumably we still want this for 2.1, right?

- public virtual ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken))
- public virtual ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))

@danmosemsft this is an easy one

@danmoseley
Copy link
Member

Let's roll this in with any other consistentification we decide on tomorrow.

@JeremyKuhne
Copy link
Member

Let's roll this in with any other consistentification we decide on tomorrow.

Confirmed that we want to match existing param names.

@ViktorHofer
Copy link
Member

Jeremy have you already started with this? That should be quickly done. Should I help?

@Anipik Anipik self-assigned this Mar 22, 2018
@Anipik Anipik closed this as completed Mar 23, 2018
@Anipik Anipik reopened this Mar 23, 2018
@Anipik
Copy link
Contributor

Anipik commented Mar 23, 2018

@stephentoub is anything left here ? Coreclr and Corefx are merged. Corert doesnt have anything except the common folder

@stephentoub
Copy link
Member Author

I still see some uses of source/destination after your changes:

  D:\repos\corefx\src\System.IO.Compression\src\System\IO\Compression\PositionPreservingWriteOnlyStreamWrapper.netcoreapp.cs(18):        public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
  D:\repos\corefx\src\System.IO.Compression.Brotli\src\System\IO\Compression\enc\BrotliStream.Compress.cs(66):        public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
  D:\repos\corefx\src\System.Net.Http\src\System\Net\Http\HttpContent.cs(734):            public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken)
  D:\repos\corefx\src\System.Net.Http\src\System\Net\Http\HttpContent.cs(885):            public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
  D:\repos\corefx\src\System.Net.Http\src\System\Net\Http\MultipartContent.cs(586):            public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default) { throw new NotSupportedException(); }
  D:\repos\corefx\src\System.Net.Http\src\System\Net\Http\StreamContent.cs(170):            public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
  D:\repos\corefx\src\System.Net.Http\src\System\Net\Http\SocketsHttpHandler\ChunkedEncodingWriteStream.cs(21):            public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken ignored)
  D:\repos\corefx\src\System.Net.Http\src\System\Net\Http\SocketsHttpHandler\ContentLengthWriteStream.cs(19):            public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken ignored) // token ignored as it comes from SendAsync

  D:\repos\corefx\src\System.IO.Compression.Brotli\src\System\IO\Compression\dec\BrotliStream.Decompress.cs(83):        public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken))
  D:\repos\corefx\src\System.Net.Http\src\System\Net\Http\MultipartContent.cs(456):            public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default) =>
  D:\repos\corefx\src\System.Net.Http\src\System\Net\Http\CurlHandler\CurlHandler.CurlResponseMessage.cs(256):            public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)

so it'd be good to clean those up, too.

If the only streams in corert are in shared, then there's nothing special to be done there.

Thanks.

@Anipik Anipik closed this as completed Mar 24, 2018
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants