-
Notifications
You must be signed in to change notification settings - Fork 108
Add support for gRPC calls. #100
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
Conversation
4b76db7
to
d83447f
Compare
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.
Could you rebase this PR on top of current master
? Also, please regenerate Bazel rules using cargo-raze
version mentioned in the README.md
, and add the example to BUILD
file.
afcd8ac
to
b978698
Compare
Signed-off-by: Rei Shimizu <[email protected]> Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
.github/workflows/rust.yml
Outdated
@@ -132,7 +133,7 @@ jobs: | |||
run: cargo doc --no-deps --target=wasm32-unknown-unknown | |||
|
|||
- name: Package (publish) | |||
run: cargo publish --dry-run --target=wasm32-unknown-unknown | |||
run: cargo publish --dry-run --target=wasm32-unknown-unknown --no-verify |
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 change is because CI will generate example/grpc_call/helloworld.rs
while publishing but the commit doesn't have this file and to resolve this mismatch. If we include this file in this codebase, we will face mismatch also while publishing because built file doesn't have licence but committed file has this one. licencer
doesn't have `exclude' option to skip verify while validation on dir walk. so we must add licence to the file while committing. If we have this PR on licencer, we don't have this workaround.
@PiotrSikora friendly ping |
@Shikugawa having protobuf compiler as a build dependency for the library is quite unfortunate, and I don't this acceptable. I see 3 options:
|
Signed-off-by: Shikugawa <[email protected]>
@PiotrSikora For now we should delete grpc callout example. |
Signed-off-by: Shikugawa <[email protected]>
@PiotrSikora Could we merge this? |
I'll get back to reviewing this in a day or two, sorry. |
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
message, | ||
timeout, | ||
) | ||
} |
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.
Sorry for missing it earlier, but you're missing grpc_cancel
host call (it should probably be called cancel_grpc_call
to match the existing naming convention).
Signed-off-by: Shikugawa <[email protected]>
src/hostcalls.rs
Outdated
status => panic!("unexpected status: {}", status as u32), | ||
} | ||
} | ||
} |
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 don't believe grpc_close
is used for gRPC call, it's effectively an alias for grpc_cancel
.
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 agree with it. But host provides a path to reset gRPC call so that we should provide it on SDK side, I think.
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.
What I'm saying is that both grpc_cancel
and grpc_close
are doing exactly the same thing in Envoy for gRPC calls:
Context::grpcClose
:
https://github.com/envoyproxy/envoy/blob/87d5eb7d44e4b24b2d098ce073f8742610c5d03e/source/extensions/common/wasm/context.cc#L1886-L1895
Context::grpcCancel
:
https://github.com/envoyproxy/envoy/blob/87d5eb7d44e4b24b2d098ce073f8742610c5d03e/source/extensions/common/wasm/context.cc#L1913-L1922
It would be actually interesting to see what happens on the wire, i.e.is it RST_STREAM(CANCEL)
?
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.
Ok. so we should provide cancel_grpc_call
on unary call, and cancel_grpc_stream
which send RST_STREAM
and close_grpc_stream
which transit the caller state to Half-Closed
, Right?
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.
Right.
Signed-off-by: Shikugawa <[email protected]>
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'll run some end-to-end tests tomorrow before merging, but everything looks good.
Thanks and sorry for the nitpicking!
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.
There is no support for reading the gRPC response. Please add it.
You only need to add |
Signed-off-by: shikugawa <[email protected]>
@PiotrSikora Sorry for my delay! I added |
Those are actually not available in unary gRPC calls. Compare Envoy interfaces for gRPC calls and gRPC streams. |
@PiotrSikora After merged this, I will continue to work #101. So I don't think it should be a problem for users. |
If you want to include them in #101 that's great, but I think they should be removed from this PR. |
Signed-off-by: shikugawa <[email protected]>
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, sans nit.
Signed-off-by: shikugawa <[email protected]>
Thanks! |
On the next release of Envoy, we will utilize cluster-specific gRPC call. We introduce this feature on the Rust SDK side in this PR.