Documentation ¶
Index ¶
- Variables
- func Dial(addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- 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 ¶
View Source
var ( DefaultDialOptions = []grpc.DialOption{ grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxInt)), grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(math.MaxInt)), 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, }), } )
Functions ¶
func Dial ¶
func Dial(addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
func EnsureValidResponseCode ¶
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 ¶
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()
Click to show internal directories.
Click to hide internal directories.