-
Notifications
You must be signed in to change notification settings - Fork 7
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
Initial upload of a GRPC implementation for Helidon #259
Conversation
A couple questions we should probably answer in the documentation for this PR: |
@jsync-swirlds, I'll add these to the issue itself (since it is more about the motivation rather than the solution) |
I have put a message on their issue: helidon-io/helidon#5418. I will try to create a PR for Helidon that creates the right abstraction for us, such that our module could be truly minimal and hopefully avoid having to duplicate any work with what they're doing. |
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjConfigBlueprint.java
Outdated
Show resolved
Hide resolved
...core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjErrorProtocolHandler.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolHandler.java
Outdated
Show resolved
Hide resolved
JUnit Test Report 66 files +11 66 suites +11 2m 18s ⏱️ -1s Results for commit 1aed82c. ± Comparison against base commit aa12028. This pull request removes 8 and adds 50 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences🚀 Don’t miss a bit, follow what’s new on Codacy. Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more |
Integration Test Report 289 files ±0 289 suites ±0 9m 13s ⏱️ +33s Results for commit 1aed82c. ± Comparison against base commit aa12028. This pull request removes 3 and adds 3 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
pbj-core/gradle/plugins/src/main/kotlin/com.hedera.pbj.protoc.gradle.kts
Outdated
Show resolved
Hide resolved
pbj-core/pbj-compiler/src/main/java/com/hedera/pbj/compiler/impl/Common.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/DeadlineDetector.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-runtime/src/test/java/com/hedera/pbj/runtime/ProtoParserToolsTest.java
Outdated
Show resolved
Hide resolved
7126643
to
c034ac1
Compare
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
…e Service Interface. New Pipelines class with all the Flow.* work and a fluent API for building out the handling pipeline. Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
…e Service Interface. New Pipelines class with all the Flow.* work and a fluent API for building out the handling pipeline. Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
…notation processors Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
9ae39fd
to
4d54f8b
Compare
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolHandler.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-compiler/src/main/java/com/hedera/pbj/compiler/impl/generators/ModelGenerator.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjMethodRoute.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjMethodRoute.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjMethodRoute.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolHandler.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolHandler.java
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjMethodRoute.java
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjMethodRoute.java
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolHandler.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolHandler.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolHandler.java
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolHandler.java
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolSelector.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolSelector.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-grpc-helidon/src/main/java/com/hedera/pbj/grpc/helidon/PbjProtocolSelector.java
Outdated
Show resolved
Hide resolved
Signed-off-by: litt <[email protected]>
Signed-off-by: litt <[email protected]>
Signed-off-by: litt <[email protected]>
Signed-off-by: litt <[email protected]>
Signed-off-by: litt <[email protected]>
Signed-off-by: litt <[email protected]>
Signed-off-by: litt <[email protected]>
Signed-off-by: litt <[email protected]>
Signed-off-by: litt <[email protected]>
This PR introduces a new module,
pbj-grpc-helidon
. This is a Helidon specific module (for version 4.0.8+) that provides the glue between HTTP2 (implemented by Helidon) and PBJ service endpoints (generated by PBJ based on a service definition in the protobuf schema files).This PR does not introduce changes to the compiler to generate service interfaces or stubs. Rather, it assumes some other PR will do that, and it focuses on defining the runtime API and the Helidon module. Changes to the compiler will be done by #255.
In this PR:
pbj-grpc-helidon
is addedpbj-grpc-helidon-config
is addedServiceInterface
is added topbj-runtime
along with other gRPC interfacesgRPC
gRPC is an HTTP2-based protocol for message passing. The specification and the documentation show how this is done. Both
application/grpc+proto
(protobuf based messages) andapplication/grpc+json
(JSON-encoded protobuf) are supported.A separate specification for web-grpc exists, but is not supported by this PR.
pbj-grpc-helidon
Public API in this module used directly by users include
PbjRouting
, andGrpcStatus
.Public API in this module used by Helidon directly include
PbjProtocolSelector
,PbjProtocolProvider
,PbjProtocolConfigProvider
, andPbjConfig
.All other entities are private to the module.
Design
Helidon uses the
ServiceLoader
to identify theProtocolConfigProvider
(used for configuration) and theHttp2SubProtocolProvider
to delegate HTTP2 calls to. Our implementation ofHttp2SubProtocolProvider
,PbjProtocolProvider
, is simply used to create (based on some provided configuration) theHttp2SubProtocolSelector
. This selector is where all the real works happens. For this module, that isPbjProtocolSelector
.If you look into the
PbjProtocolSelector
, you will find thesubProtocol
method. This method is called by Helidon. It is the main entry point for handling HTTP2 routes supported by this system. After some preliminary checks, it delegates to a "handler" (PbjErrorProtocolHandler
orPbjProtocolHandler
) to handle appropriate details (reading from and writing to HTTP2 streams).The
PbjProtocolHandler
will delegate to aServiceInterface
to handle a particular method invocation, in such a way as to avoid all reflection. It provides a callback to theServiceInterface
through which theServiceInterface
can send start a request, stream messages, and close a request. The implementation of this callback handles all the glue with HTTP2.That is, the classes in
pbj-grpc-helidon
are the glue between the HTTP code of Helidon (that knows nothing about gRPC or PBJ), and the PBJServiceInterface
s, which know nothing about HTTP2.