mirror of
https://github.com/linka-cloud/grpc.git
synced 2024-11-24 20:06:25 +00:00
Adphi
c7096975b1
health: set services serving on start and not available on close Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
36 lines
730 B
Go
36 lines
730 B
Go
package interceptors
|
|
|
|
import (
|
|
"context"
|
|
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type ServerInterceptors interface {
|
|
UnaryServerInterceptor() grpc.UnaryServerInterceptor
|
|
StreamServerInterceptor() grpc.StreamServerInterceptor
|
|
}
|
|
|
|
type ClientInterceptors interface {
|
|
UnaryClientInterceptor() grpc.UnaryClientInterceptor
|
|
StreamClientInterceptor() grpc.StreamClientInterceptor
|
|
}
|
|
|
|
type Interceptors interface {
|
|
ServerInterceptors
|
|
ClientInterceptors
|
|
}
|
|
|
|
func NewContextServerStream(ctx context.Context, ss grpc.ServerStream) grpc.ServerStream {
|
|
return &ContextWrapper{ServerStream: ss, ctx: ctx}
|
|
}
|
|
|
|
type ContextWrapper struct {
|
|
grpc.ServerStream
|
|
ctx context.Context
|
|
}
|
|
|
|
func (w *ContextWrapper) Context() context.Context {
|
|
return w.ctx
|
|
}
|