wgrpc

package
v0.0.0-...-849f898 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallDispatch

func CallDispatch(ctx context.Context, svcName, tag string, in *protoc.DispatchReq) (*protoc.DispatchResp, error)

CallDispatch call a grpc service: lb_policy = random

func CallRaw

func CallRaw(ctx context.Context, svcName, tag string, caller GrpcMethodCaller) (proto.Message, error)

CallRaw generate a *grpc.ClientConn and pass to caller which make real call

func CallRawRe

func CallRawRe(ctx context.Context, svcName, tag, svcGrpcName, method string, req proto.Message, resp ...proto.Message) error

CallRawRe call a grpc service: lb_policy = random

func GenRecoverInterceptor

func GenRecoverInterceptor(handler grpc_recovery.RecoveryHandlerFunc) (grpc.UnaryServerInterceptor, grpc.StreamServerInterceptor)

GenRecoverInterceptor ...

func InitModules

func InitModules(svcCenterAddr, jaegerAgentAddr string) error

InitModules ...

func RegistDispatchHander

func RegistDispatchHander(cmd int32, handler DispatchHandler) error

RegistDispatchHander regist handlers for dispatcher

func StreamServerInterceptorAccessLog

func StreamServerInterceptorAccessLog() grpc.StreamServerInterceptor

StreamServerInterceptorAccessLog ...

func UnaryClientInterceptorJaeger

func UnaryClientInterceptorJaeger() grpc.UnaryClientInterceptor

UnaryClientInterceptorJaeger ...

func UnaryServerInterceptorAccessLog

func UnaryServerInterceptorAccessLog() grpc.UnaryServerInterceptor

UnaryServerInterceptorAccessLog ...

func UnaryServerInterceptorJaeger

func UnaryServerInterceptorJaeger() grpc.UnaryServerInterceptor

UnaryServerInterceptorJaeger ...

Types

type DispatchHandler

type DispatchHandler func(context.Context, *protoc.RouteHeader, []byte) (*protoc.DispatchResp, error)

DispatchHandler handler for DispatchSvc

type GrpcMethodCaller

type GrpcMethodCaller func(ctx context.Context, conn *grpc.ClientConn) (proto.Message, error)

GrpcMethodCaller with conn, make real call

type ServerInfo

type ServerInfo struct {
	UniqID           string
	Name             string
	Host             string
	Port             int
	ConnTimeoutSec   int
	Tags             []string
	AddrConsulCenter string
	AddrJaegerAgent  string
}

ServerInfo ...

type SvcRegistFunc

type SvcRegistFunc func(s *WServer) error

SvcRegistFunc in this function, we should regist services to grpc server

type WGrpcClient

type WGrpcClient struct {
	*grpc.ClientConn
}

type WServer

type WServer struct {
	*grpc.Server
	// contains filtered or unexported fields
}

WServer warpper of grpc server

func NewDispatchServer

func NewDispatchServer(name, port string, register SvcRegistFunc, opt ...grpc.ServerOption) *WServer

NewDispatchServer generate a grpc server which has a service named DispatchSvc

func NewWServer

func NewWServer(srv *ServerInfo, certFile, keyFile string, opt ...grpc.ServerOption) (*WServer, error)

NewWServer new instance of WServer

func (*WServer) Start

func (s *WServer) Start() error

Start start to serve

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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