Documentation ¶
Index ¶
- Variables
- func Dial(addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func DialOptsWithMetrics(clientMetrics *grpc_prometheus.ClientMetrics) []grpc.DialOption
- func EnsureValidResponseCode(code int) int
- func Errorf(code int, tmpl string, args ...interface{}) error
- func GetGRPCErrorFromHTTPResponse(resp *httppb.HandleSimpleHTTPResponse) error
- func GetHTTPHeader(hs http.Header) []*httppb.Element
- func GetHTTPResponseFromError(err error) (*httppb.HandleSimpleHTTPResponse, bool)
- func MergeHTTPHeader(hs []*httppb.Element, header http.Header)
- func NewDefaultServer(opts []grpc.ServerOption) *grpc.Server
- func NewListener() (net.Listener, error)
- func Serve(listener net.Listener, grpcServerFunc func([]grpc.ServerOption) *grpc.Server)
- func TimestampAsTime(ts *tspb.Timestamp) (time.Time, error)
- func TimestampFromTime(time time.Time) *tspb.Timestamp
- type ServerCloser
Constants ¶
This section is empty.
Variables ¶
var ( DefaultDialOptions = []grpc.DialOption{ grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt), grpc.MaxCallSendMsgSize(math.MaxInt), grpc.WaitForReady(true), ), grpc.WithKeepaliveParams(keepalive.ClientParameters{ Time: defaultClientKeepAliveTime, Timeout: defaultClientKeepAliveTimeOut, PermitWithoutStream: defaultPermitWithoutStream, }), } DefaultServerOptions = []grpc.ServerOption{ grpc.MaxRecvMsgSize(math.MaxInt), grpc.MaxSendMsgSize(math.MaxInt), grpc.MaxConcurrentStreams(math.MaxUint32), grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ MinTime: defaultServerKeepAliveMinTime, PermitWithoutStream: defaultPermitWithoutStream, }), grpc.KeepaliveParams(keepalive.ServerParameters{ Time: defaultServerKeepAliveInterval, Timeout: defaultServerKeepAliveTimeout, MaxConnectionAge: defaultServerMaxConnectionAge, MaxConnectionAgeGrace: defaultServerMaxConnectionAgeGrace, }), } )
Functions ¶
func Dial ¶
func Dial(addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
func DialOptsWithMetrics ¶ added in v1.8.4
func DialOptsWithMetrics(clientMetrics *grpc_prometheus.ClientMetrics) []grpc.DialOption
DialOptsWithMetrics registers gRPC client metrics via chain interceptors.
func EnsureValidResponseCode ¶ added in v1.8.4
EnsureValidResponseCode ensures that the response code is valid otherwise it returns 500.
func GetGRPCErrorFromHTTPResponse ¶
func GetGRPCErrorFromHTTPResponse(resp *httppb.HandleSimpleHTTPResponse) error
GetGRPCErrorFromHTTPRespone takes an HandleSimpleHTTPResponse as input and returns a gRPC error.
func GetHTTPHeader ¶
GetHTTPHeader takes an http.Header as input and returns a slice of Header.
func GetHTTPResponseFromError ¶
func GetHTTPResponseFromError(err error) (*httppb.HandleSimpleHTTPResponse, bool)
GetHTTPResponseFromError takes an gRPC error as input and returns a gRPC HandleSimpleHTTPResponse.
func MergeHTTPHeader ¶
MergeHTTPHeader takes a slice of Header and merges with http.Header map.
func NewDefaultServer ¶
func NewDefaultServer(opts []grpc.ServerOption) *grpc.Server
NewDefaultServer ensures the plugin service is served with proper defaults. This should always be passed to GRPCServer field of plugin.ServeConfig.
func NewListener ¶
func TimestampAsTime ¶ added in v1.8.4
TimestampAsTime validates timestamppb timestamp and returns time.Time.
Types ¶
type ServerCloser ¶
type ServerCloser struct {
// contains filtered or unexported fields
}
func (*ServerCloser) Add ¶
func (s *ServerCloser) Add(server *grpc.Server)
func (*ServerCloser) GracefulStop ¶
func (s *ServerCloser) GracefulStop()
func (*ServerCloser) Stop ¶
func (s *ServerCloser) Stop()