Add initial DataStreamDownload API implementation#185
Conversation
| oneof Properties | ||
| { | ||
| DataStreamFixedTypeProperties FixedTypeProperties = 3; | ||
| DataStreamContinuousTypeProperties ContinuousTypeProperties = 4; | ||
| } |
There was a problem hiding this comment.
We should de-dupe Properties from the oneof field names. Also, Type probably isn't needed either:
oneof Properties
{
DataStreamFixedTypeProperties Fixed = 3;
DataStreamContinuousTypeProperties Continuous = 4;
}| } | ||
|
|
||
| void | ||
| DataStreamWriter::HandleFailure(const std::string errorMessage) |
There was a problem hiding this comment.
This is accepting a copy of the string, and then I believe another copy is made when passed to set_message. It probably makes sense to accept a const std::string& here instead, which will avoid 1 of those copies.
Also, in general, when accepting a copy/value of an argument, it's usually a good idea to accept it as non-const so the function can use it however it likes, since it owns that memory.
| DataStreamReader::Await(uint32_t* numberOfDataBlocksReceived, DataStreamOperationStatus* operationStatus) | ||
| { | ||
| std::unique_lock lock(m_readStatusGate); | ||
| static constexpr auto timeoutValue = 10s; |
There was a problem hiding this comment.
I think we'll want to eventually use these test classes outside test code (and move them to a common lib at that time).
In that case, it's likely we'll want to make this timeout value configurable. Suggest to at least add a member to DataStreamMember and read the member here instead of using the constant. Completely fine if the member is just initialized to a constant (with this value) and no way is provided for configuring it for now.
| DataStreamTypeContinuous = 2; | ||
| } | ||
|
|
||
| enum DataStreamPattern |
There was a problem hiding this comment.
Does this refer to the throughput pattern, for example, the timing/rate of the data flow? In that case, Constant == an uninterrupted flow of data, correct?
There was a problem hiding this comment.
Right, Constant would be a steady pattern with each data message being the same number of bytes
| bytes Data = 1; | ||
| uint32 SequenceNumber = 2; | ||
| DataStreamOperationStatus Status = 3; |
There was a problem hiding this comment.
Is Data only present/valid when Status == Succeeded? If so, suggest re-ordering these such that always-present/valid fields are first, then optional/conditional ones following.
There was a problem hiding this comment.
Yes that's true. I can re-order the fields so that Status is first since that will always be present.
| DataStreamDownloadRequest request{}; | ||
| *request.mutable_properties() = std::move(properties); | ||
|
|
||
| auto dataStreamReader = std::make_unique<DataStreamReader>(client.get(), &request); |
There was a problem hiding this comment.
Any reason this can't be allocated on the stack instead? Eg.
DataStreamReader dataStreamReader{ client.get(), &request };
// ...
grpc::Status status = dataStreamReader.Await(&numberOfDataBlocksReceived, &operationStatus);There was a problem hiding this comment.
I believe it can be stack allocated. Will update
| if (m_data.sequencenumber() != m_numberOfDataBlocksReceived) { | ||
| DataStreamOperationStatus status{}; | ||
| status.set_code(DataStreamOperationStatusCode::DataStreamOperationStatusCodeFailed); |
There was a problem hiding this comment.
Looking at this now, would it be helpful to know when mismatched sequencing occurs? Might this allow us to help quantify the number of blocks dropped/lost?
There was a problem hiding this comment.
That's a good idea. It would be easy to tell - basically move this check into OnReadDone. We'd need to decide if we want to stop reading and cancel the RPC as soon as the first sequencing mismatch occurs, or if we want to keep going and later count how many blocks were dropped.
There was a problem hiding this comment.
Going to defer this until a bit later since it's test code - tracked by #186
Type
Side Effects
Goals
This PR adds the initial implementation of the
DataStreamDownloadAPI, including the API itself, the foundational service implementation and reactor class, a test client reactor class, and a basic unit test.Technical Details
DataStreamDownloadAPI toNetRemoteDataStreamingService.proto, along with applicable types intoNetRemoteDataStream.proto.DataStreamWriterimplementation of the gRPCServerWriteReactorreactor class toNetRemoteDataStreamingReactors.ClientReadReactorreactor class.new/delete.Test Results
All tests pass.
Reviewer Focus
None.
Future Work
DataStreamPatternoptions from the client'sDataStreamDownloadRequest.DataStreamTypeContinuouswithDataStreamPatternConstant.Checklist
allcompiles cleanly.