grpcserver

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

实现文件 grpcserver 基于 grpc 实现的 rpc-server

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrServiceUnavailiable 没有可用的服务
	ErrServiceUnavailiable = errors.New("service not registered")
)

Functions

func BuildWithOption

func BuildWithOption(info meta.ServiceInfo, log *blog.Logger, opts ...Option) module.IServer

Types

type Option

type Option func(*Parm)

Option config wraps

func AppendStreamInterceptors

func AppendStreamInterceptors(interceptor grpc.StreamServerInterceptor) Option

func AppendUnaryInterceptors

func AppendUnaryInterceptors(interceptor grpc.UnaryServerInterceptor) Option

func RegisterHandler

func RegisterHandler(handler RegistHandler) Option

func WithGracefulStop

func WithGracefulStop() Option

func WithListen

func WithListen(address string) Option

WithListen 服务器侦听地址配置

type Parm

type Parm struct {
	ListenAddr string

	UnaryInterceptors  []grpc.UnaryServerInterceptor
	StreamInterceptors []grpc.StreamServerInterceptor

	Handler RegistHandler

	GracefulStop bool
}

Parm Service 配置

type RegistHandler

type RegistHandler func(*grpc.Server)

Jump to

Keyboard shortcuts

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