grpc

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRPCClient added in v1.0.8

func NewRPCClient(cfg *ClientConfig) *grpc.ClientConn

func TracingInterceptor added in v1.0.14

func TracingInterceptor() grpc.UnaryServerInterceptor

Tracing Interceptor ....

func UnaryClientInterceptor added in v1.0.8

func UnaryClientInterceptor(cb *circuitbreaker.CircuitBreaker, handler OpenStateHandler) grpc.UnaryClientInterceptor

Types

type Circuitbreaker added in v1.0.8

type Circuitbreaker struct {
	CounterResetInterval xtime.Duration // 断路器间隔时间
	Threshold            int64          // 计数器阈值
	OpenTimeout          xtime.Duration // 超时时间
	HalfOpenMaxSuccesses int64          // HalfOpen 次数
}

type ClientConfig added in v1.0.8

type ClientConfig struct {
	Addr           string
	LoadBalancing  string
	Timeout        xtime.Duration
	RequestTimeout xtime.Duration
	Circuitbreaker Circuitbreaker
}

type OpenStateHandler added in v1.0.8

type OpenStateHandler func(ctx context.Context, method string, req interface{})

type Server

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

func NewServer

func NewServer(c *ServerConfig, opts ...xgprc.ServerOption) (s *Server, err error)

func (*Server) Serve

func (s *Server) Serve(lis net.Listener) error

func (*Server) Server

func (s *Server) Server() *xgprc.Server

func (*Server) Start

func (s *Server) Start()

func (*Server) Stop added in v1.0.7

func (s *Server) Stop()

func (*Server) Use

func (s *Server) Use(interceptors ...xgprc.UnaryServerInterceptor) *Server

type ServerConfig

type ServerConfig struct {
	Network           string
	Addr              string
	Timeout           xtime.Duration
	IdleTimeout       xtime.Duration
	MaxLifeTime       xtime.Duration
	ForceCloseWait    xtime.Duration
	KeepAliveInterval xtime.Duration
	KeepAliveTimeout  xtime.Duration
	LogFlag           int8
}

Jump to

Keyboard shortcuts

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