grpcx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: MIT Imports: 21 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterGrpcServerOption

func RegisterGrpcServerOption(name string, handler func(cnf *conf.Configuration) grpc.ServerOption)

func RegisterGrpcStreamInterceptor added in v0.0.3

func RegisterGrpcStreamInterceptor(name string, handler func(*conf.Configuration) grpc.StreamServerInterceptor)

func RegisterGrpcUnaryInterceptor

func RegisterGrpcUnaryInterceptor(name string, handler func(*conf.Configuration) grpc.UnaryServerInterceptor)

Types

type Option

type Option func(s *serverOptions)

func UseLogger

func UseLogger() Option

UseLogger use component logger named "grpc" and set grpclog use zap logger.It is used by default.

func WithConfiguration added in v0.0.3

func WithConfiguration(cfg *conf.Configuration) Option

func WithGracefulStop added in v0.1.0

func WithGracefulStop() Option

WithGracefulStop indicate use graceful stop

func WithGrpcOption

func WithGrpcOption(opts ...grpc.ServerOption) Option

type Server

type Server struct {

	// ServiceInfos is for service discovery,it converts from grpc service info
	ServiceInfos []*registry.ServiceInfo
	// contains filtered or unexported fields
}

Server is the grpcx server

func New

func New(opts ...Option) *Server

func (*Server) Apply

func (s *Server) Apply(cfg *conf.Configuration)

func (*Server) Engine

func (s *Server) Engine() *grpc.Server

func (*Server) ListenAndServe added in v0.0.3

func (s *Server) ListenAndServe() error

func (*Server) Run

func (s *Server) Run() error

Run is a sample way to start the grpc server with gracefulStop stop

func (*Server) Start added in v0.1.0

func (s *Server) Start(ctx context.Context) error

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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