Refactor IOperation.Write to IOperation.SendAsync

Description

Returning a byte array from Write limits our options for memory management. We could refactor to an IMemoryOwner<byte>, but that puts the onus on the caller to handle disposing.

On the other hand, if we refactor "byte[] Write()" to "Task SendAsync(IConnection connection), this makes the interface simpler. Any kind of memory (byte array or ReadOnlyMemory<byte>) can be passed on to IConnection, without changing memory ownership. Additionally, the caller is no longer required to pass in op.Completed as a parameter to IConnection.SendAsync, the operation can provide this itself, which creates a cleaner API.

Environment

None

Gerrit Reviews

None

Release Notes Description

None

Activity

Show:
Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Story Points

Components

Fix versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created April 2, 2019 at 1:04 AM
Updated April 24, 2020 at 8:24 PM
Resolved April 4, 2019 at 11:10 PM
Instabug