-
Notifications
You must be signed in to change notification settings - Fork 42
grpc: Add interceptor API #484
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
796d4eb to
52b0657
Compare
Mr3zee
left a comment
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.
Great work! I have some comments nitpicking some details, mostly DSL, but everything else is well designed
and btw kDocs are really good there, quite easy to read and understand
grpc/grpc-core/src/commonMain/kotlin/kotlinx/rpc/grpc/internal/suspendClientCalls.kt
Show resolved
Hide resolved
grpc/grpc-core/src/commonMain/kotlin/kotlinx/rpc/grpc/internal/suspendServerCalls.kt
Outdated
Show resolved
Hide resolved
grpc/grpc-core/src/commonMain/kotlin/kotlinx/rpc/grpc/internal/suspendServerCalls.kt
Show resolved
Hide resolved
grpc/grpc-core/src/commonMain/kotlin/kotlinx/rpc/grpc/ManagedChannel.kt
Outdated
Show resolved
Hide resolved
grpc/grpc-core/src/commonMain/kotlin/kotlinx/rpc/grpc/ServerInterceptor.kt
Outdated
Show resolved
Hide resolved
grpc/grpc-core/src/commonTest/kotlin/kotlinx/rpc/grpc/test/BaseGrpcServiceTest.kt
Outdated
Show resolved
Hide resolved
grpc/grpc-core/src/nativeMain/kotlin/kotlinx/rpc/grpc/internal/NativeClientCall.kt
Show resolved
Hide resolved
grpc/grpc-core/src/nativeMain/kotlin/kotlinx/rpc/grpc/internal/NativeClientCall.kt
Show resolved
Hide resolved
grpc/grpc-core/src/nativeMain/kotlin/kotlinx/rpc/grpc/internal/NativeClientCall.kt
Show resolved
Hide resolved
Mr3zee
left a comment
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.
Great, thank you!
grpc/grpc-core/src/commonMain/kotlin/kotlinx/rpc/grpc/GrpcServer.kt
Outdated
Show resolved
Hide resolved
grpc/grpc-core/src/commonMain/kotlin/kotlinx/rpc/grpc/GrpcServer.kt
Outdated
Show resolved
Hide resolved
grpc/grpc-core/src/commonTest/kotlin/kotlinx/rpc/grpc/test/RawClientTest.kt
Outdated
Show resolved
Hide resolved
|
Will there be an interceptor feature in KRPC too? It would be really handy for the same use cases as presented here. |
|
@morki in some sort, yes, though later, we only maintain kRPC now, until we finish with gRPC (which is not much else to do, but still will take a couple of months) |
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
Signed-off-by: Johannes Zottele <[email protected]>
e554b06 to
0a34abe
Compare
Signed-off-by: Johannes Zottele <[email protected]>
* grpc: Add client interceptor support Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add client interceptor support Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add server interceptor support Signed-off-by: Johannes Zottele <[email protected]> * grpc: Refactor server scope API Signed-off-by: Johannes Zottele <[email protected]> * grpc: Refactor client scope API Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add tests Signed-off-by: Johannes Zottele <[email protected]> * grpc: Rename GrpcTrailers to GrpcMetadata.kt Signed-off-by: Johannes Zottele <[email protected]> * grpc: Refactor cancel API in ClientCallScope to return Nothing Signed-off-by: Johannes Zottele <[email protected]> * grpc: Remove println Signed-off-by: Johannes Zottele <[email protected]> * grpc: Adjust metadata names Signed-off-by: Johannes Zottele <[email protected]> * grpc: Fix Ktor server constructor Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add documentation Signed-off-by: Johannes Zottele <[email protected]> * grpc: Adjust client/server DSL and provide documentation Signed-off-by: Johannes Zottele <[email protected]> * grpc: Fix race condition bug Signed-off-by: Johannes Zottele <[email protected]> * grpc: Fix context not set Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add multi interceptor tests Signed-off-by: Johannes Zottele <[email protected]> * grpc: Address PR comments Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add client interceptor execution order test Signed-off-by: Johannes Zottele <[email protected]> * grpc: Address PR comments Signed-off-by: Johannes Zottele <[email protected]> * grpc: Fixing bug after rebase Signed-off-by: Johannes Zottele <[email protected]> * grpc: Fix default proto package in service name --------- Signed-off-by: Johannes Zottele <[email protected]>
* grpc: Add client interceptor support Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add client interceptor support Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add server interceptor support Signed-off-by: Johannes Zottele <[email protected]> * grpc: Refactor server scope API Signed-off-by: Johannes Zottele <[email protected]> * grpc: Refactor client scope API Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add tests Signed-off-by: Johannes Zottele <[email protected]> * grpc: Rename GrpcTrailers to GrpcMetadata.kt Signed-off-by: Johannes Zottele <[email protected]> * grpc: Refactor cancel API in ClientCallScope to return Nothing Signed-off-by: Johannes Zottele <[email protected]> * grpc: Remove println Signed-off-by: Johannes Zottele <[email protected]> * grpc: Adjust metadata names Signed-off-by: Johannes Zottele <[email protected]> * grpc: Fix Ktor server constructor Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add documentation Signed-off-by: Johannes Zottele <[email protected]> * grpc: Adjust client/server DSL and provide documentation Signed-off-by: Johannes Zottele <[email protected]> * grpc: Fix race condition bug Signed-off-by: Johannes Zottele <[email protected]> * grpc: Fix context not set Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add multi interceptor tests Signed-off-by: Johannes Zottele <[email protected]> * grpc: Address PR comments Signed-off-by: Johannes Zottele <[email protected]> * grpc: Add client interceptor execution order test Signed-off-by: Johannes Zottele <[email protected]> * grpc: Address PR comments Signed-off-by: Johannes Zottele <[email protected]> * grpc: Fixing bug after rebase Signed-off-by: Johannes Zottele <[email protected]> * grpc: Fix default proto package in service name --------- Signed-off-by: Johannes Zottele <[email protected]>
Subsystem
gRPC
Problem Description
A main feature of all gRPC libraries is their interceptor API.
We want a Kotlin idiomatic simple-to-use interceptor API (for client and server) that allows users to implement things like authentication, logging or tracing.
Solution
This PR adds a convenient Kotlin idiomatic interceptor API.
E.g. a (over-simplified) server-side authorization interceptor could look like this