Documentation ¶
Index ¶
- Constants
- Variables
- func SetLog(l logger.Logger)
- type Cfg
- type GrpcServer
- func (g GrpcServer) AddStreamServerInterceptors(interceptors ...grpc.StreamServerInterceptor)
- func (g GrpcServer) AddUnaryServerInterceptors(interceptors ...grpc.UnaryServerInterceptor)
- func (g GrpcServer) EnableDebug()
- func (g GrpcServer) GetDefaultServerOpts() []grpc.ServerOption
- func (g GrpcServer) Init(opts ...grpc.ServerOption) (gErr error)
- func (g GrpcServer) RegisterService(register interface{}, handler interface{}) (err error)
- func (g GrpcServer) Start() (gErr error)
- func (g GrpcServer) Stop() error
Constants ¶
View Source
const ( // DefaultMaxMsgSize define maximum message size that server can send // or receive. Default value is 4MB. DefaultMaxMsgSize = 1024 * 1024 * 4 // DefaultAddress default grpc server address DefaultAddress = ":8081" )
Variables ¶
View Source
var ( DefaultServerParameters = keepalive.ServerParameters{ MaxConnectionIdle: 30 * time.Second, MaxConnectionAge: 55 * time.Second, MaxConnectionAgeGrace: 5 * time.Second, Time: 10 * time.Second, Timeout: 2 * time.Second, } DefaultEnforcementPolicy = keepalive.EnforcementPolicy{ MinTime: 5 * time.Second, PermitWithoutStream: true, } DefaultCfg = Cfg{ MaxMsgSize: DefaultMaxMsgSize, } )
Functions ¶
Types ¶
type GrpcServer ¶
type GrpcServer struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfgs ...Cfg) *GrpcServer
func (GrpcServer) AddStreamServerInterceptors ¶
func (g GrpcServer) AddStreamServerInterceptors(interceptors ...grpc.StreamServerInterceptor)
func (GrpcServer) AddUnaryServerInterceptors ¶
func (g GrpcServer) AddUnaryServerInterceptors(interceptors ...grpc.UnaryServerInterceptor)
func (GrpcServer) EnableDebug ¶
func (g GrpcServer) EnableDebug()
EnableDebug https://github.com/grpc/grpc-experiments/tree/master/gdebug
func (GrpcServer) GetDefaultServerOpts ¶
func (g GrpcServer) GetDefaultServerOpts() []grpc.ServerOption
func (GrpcServer) Init ¶
func (g GrpcServer) Init(opts ...grpc.ServerOption) (gErr error)
func (GrpcServer) RegisterService ¶
func (g GrpcServer) RegisterService(register interface{}, handler interface{}) (err error)
RegisterService 注册grpc handler
Click to show internal directories.
Click to hide internal directories.