extgrpc

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option = func(o *Options)

Option is option function.

func CombineOptions

func CombineOptions(options ...Option) Option

CombineOptions combine multi Option into one.

func NoopOption

func NoopOption() Option

NoopOption return a nop option.

func WithGRPCServerOption

func WithGRPCServerOption(opt grpc.ServerOption) Option

WithGRPCServerOption allows adding raw grpc.ServerOption's to the instantiated gRPC server.

func WithGracePeriod

func WithGracePeriod(t time.Duration) Option

WithGracePeriod sets shutdown grace period for gRPC server. Server waits connections to drain for specified amount of time.

func WithListen

func WithListen(s string) Option

WithListen sets address to listen for gRPC server. Server accepts incoming connections on given address.

func WithNetwork

func WithNetwork(s string) Option

WithNetwork sets network to listen for gRPC server e.g tcp, udp or unix.

func WithOtelTracing

func WithOtelTracing() Option

WithOtelTracing append opentelemetry interceptors.

func WithServer

func WithServer(f registerServerFunc) Option

WithServer calls the passed gRPC registration functions on the created grpc.Server.

func WithStreamServerInterceptor

func WithStreamServerInterceptor(interceptor grpc.StreamServerInterceptor) Option

WithStreamServerInterceptor append a grpc StreamServerInterceptor.

func WithTLSConfig

func WithTLSConfig(cfg *tls.Config) Option

WithTLSConfig sets TLS configuration for gRPC server.

func WithUnaryServerInterceptor

func WithUnaryServerInterceptor(interceptor grpc.UnaryServerInterceptor) Option

WithUnaryServerInterceptor append a grpc UnaryServerInterceptor.

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options is extgrpc server options.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is our extgrpc server.

func NewServer

func NewServer(logger *log.Logger, probe *prober.GRPCProbe, opts ...Option) *Server

NewServer crate a new Server instance.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe listen and serve grpc server.

func (*Server) Run

func (s *Server) Run(g *run.Group, statusProber prober.Probe)

Run start grpc server with run group.

func (*Server) Shutdown

func (s *Server) Shutdown(err error)

Shutdown gracefully shuts down the server by waiting, for specified amount of time (by gracePeriod) for connections to return to idle and then shut down.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL