-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add DataStreamBidirectional API #202
Add DataStreamBidirectional API #202
Conversation
} | ||
|
||
// Create data to write to the client. | ||
const auto data = m_dataGenerator.GenerateRandomData(); |
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.
Are there plans to allow configuration of the block size?
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.
Not currently. Because this API doesn't have a "request"/"response" like regular RPCs and instead has a "stream" for both directions, there is no intuitive way to allow the client to specify a block size that it wants the server to use. I think that if there was a scenario that required that, then the DataStreamDownload API should be used instead
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.
If this is a requirement (I think it is), there are a few ways we could consider achieving this:
- Since all fields are optional in proto3 format, the first input message from the client could populate a field that specifies properties about the requested stream from the server. This field is only inspected on the first message received and otherwise not even checked for.
- Streaming could be stateful, where a request is first made to create a stream, and then that stream has to be explicitly started with the usual API. This way, both the client and server can negotiate stream properties. It could look something like this:
enum DataStreamDirection
{
Upload,
Download,
Both,
};
enum DataStreamCreateStatusCode
{
Unknown = 0,
Succeeded = 1,
Failed = 2,
// Others as needed
};
message DataStreamCreateRequest
{
DataStreamDirection Direction = 1;
DataStreamProperties PropertiesUpload = 2; // present when Direction == Upload and Both
DataStreamProperties PropertiesDownload = 2; // present when Direction == Download and Both
};
message DataStreamCreateResult
{
DataStreamCreateStatusCode Status = 0;
string StreamId = 1; // Valid/present only when Status == Succeeded
};
message DataStreamDownloadRequest
{
string StreamId = 0;
};
rpc DataStreamCreate (DataStreamCreateRequest request, DataStreamCreateResult result);
The server doesn't strictly need upload stream properties since it's just a sink and will just drop everything it receives, however, that information would also enable the server to do accounting on the streaming operation. This could be useful in triaging failures in case the problem on the client side somehow precludes correct accounting, and, it would also be useful to be able to compare accounting on each side to make sure it matched.
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.
Tracking this in #206 and will look into it later. Your first suggestion is definitely simpler and stays closer to the original design, but your second suggestion is cleaner and simple to understand, although requires a bit more work and changes the design a bit.
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.
Thanks! Both require logic on the server side to check for the presence of a field, and while intuitive for the client, having conditional logic like that feels wrong. Anyway, we can drill into this as part of #206 after we determine if this is really a requirement of not.
Type
Side Effects
Goals
This PR adds the
DataStreamBidirectional
API along with a unit test.Technical Details
DataStreamBidirectional
API toNetRemoteDataStreamingService.proto
.DataStreamReaderWriter
implementation of the gRPCServerBidiReactor
toNetRemoteDataStreamingReactors
.DataStreamReaderWriter
implementation of the gRPCClientBidiReactor
toTestNetRemoteDataStreamingReactors
.TestNetRemoteDataStreamingServiceClient
.Test Results
All tests pass.
Reviewer Focus
None.
Future Work
m_status
need to be gated.Cancel()
function and another unit test.Checklist
all
compiles cleanly.