-
Notifications
You must be signed in to change notification settings - Fork 114
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
Use bytes to represent gRPC message body #833
Conversation
87630b3
to
129d6d1
Compare
oak/server/module_invocation.cc
Outdated
@@ -223,7 +221,7 @@ void ModuleInvocation::BlockingSendResponse() { | |||
auto callback = new std::function<void(bool)>( | |||
std::bind(&ModuleInvocation::SendResponse, this, std::placeholders::_1)); | |||
stream_.Write(bb, options, callback); | |||
} else if (!grpc_response.has_rsp_msg()) { | |||
} else if (grpc_response.rsp_msg().empty()) { |
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.
This is causing tests to fail now, I am guessing because an empty bytes field is indistinguishable from a default message. @daviddrysdale do we need to keep this distinction between last message with and without payload?
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 fixed it by assuming that only exactly one between rsp_msg
and status
is set. @ipetr0v is this compatible with the Rust implementation too? If so, should we make that a oneof, and / or explain in a comment in the proto message?
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.
LGTM once Cloudbuild is happy.
@@ -29,12 +28,12 @@ import "third_party/google/rpc/status.proto"; | |||
|
|||
message GrpcRequest { | |||
string method_name = 1; | |||
google.protobuf.Any req_msg = 2; | |||
bytes req_msg = 2; |
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.
Need a comment to explain the expected contents of the field:
// Request message as a serialized protobuf; the message type is deduced from the request's method name.
bool last = 3; | ||
} | ||
|
||
message GrpcResponse { | ||
google.protobuf.Any rsp_msg = 1; | ||
bytes rsp_msg = 1; |
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.
Need a comment as above
129d6d1
to
a49c05f
Compare
This will also be useful for project-oak#819
a49c05f
to
34df463
Compare
Changes required by commit 68fbbe3 ("Use Rust Loader for running examples (#993)"): - Add and use a config that doesn't include a translator node. - Add C++ code that is equivalent to oak::grpc::server::init(). Change required by commit 64d3f90 ("Use bytes to represent gRPC message body (#833)"): - Re-work hand-coded response message for current GrpcResponse proto message definition. For #1009
This will also be useful for #819