core

package
v0.0.0-...-9362bef Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGateway

func NewGateway() *runtime.ServeMux

func NewGrpc

func NewGrpc(grpcOptions []grpc.ServerOption) *grpcServer

func NewHttp

func NewHttp(config *config.Config, grpc *grpc.Server) *httpServer

Types

type Core

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

* @desc : trpc核心struct结构体

func New

func New(config *config.Config) *Core

* @desc : 返回一个trpc结构体指针

func (*Core) AddOption

func (core *Core) AddOption(options grpc.ServerOption)

* @desc : 追加grpc options属性

func (*Core) GetGrpcServer

func (core *Core) GetGrpcServer() *grpcServer

func (*Core) GetHttpServer

func (core *Core) GetHttpServer() *httpServer

func (*Core) Run

func (core *Core) Run() error

* @desc : core.grpcServer.Run()方法中开启了一个新的协程,运行gRPC服务

func (*Core) SetReflectionStatus

func (core *Core) SetReflectionStatus(status bool)

* @desc : 设置grpc的reflection状态

func (*Core) SetStreamInterceptors

func (core *Core) SetStreamInterceptors(interceptors []grpc.StreamServerInterceptor)

* @desc : 添加Stream拦截器,这里使用grpc官方标准ChainStreamInterceptor

func (*Core) SetUnaryInterceptors

func (core *Core) SetUnaryInterceptors(interceptors []grpc.UnaryServerInterceptor)

* @desc : 添加Unray拦截器,这里使用grpc官方标准ChainUnaryInterceptor

func (*Core) WaitTermination

func (core *Core) WaitTermination(stopHook func())

* @desc : 主协程在阻塞等待保证不退出,等待系统信号来终止服务

type GrpcServer

type GrpcServer interface {
	Run() error
	Stop()
	RegisterService()
	GetListenSocket() net.Listener
	GetRawGrpcServer() *grpc.Server
}

* @desc : 声明一个gRPC interface接口

type HttpServer

type HttpServer interface {
	GetRawHttpServer()
	GetGatewayMux()
}

type MetricServer

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

func NewMetric

func NewMetric() *MetricServer

func (*MetricServer) Run

func (mSvr *MetricServer) Run()

func (*MetricServer) Stop

func (mSvr *MetricServer) Stop()

Jump to

Keyboard shortcuts

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