grpcserver

package
v2.0.0-...-c87de9c Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChainStreamServer

func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor

ChainStreamServer creates a single interceptor out of a chain of many interceptors.

Copy from grpc-ecosystem/go-grpc-middleware.

Execution is done in left-to-right order, including passing of context. For example ChainUnaryServer(one, two, three) will execute one before two before three. If you want to pass context between interceptors, use WrapServerStream.

func ChainUnaryServer

func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor

ChainUnaryServer creates a single interceptor out of a chain of many interceptors.

Copy from grpc-ecosystem/go-grpc-middleware.

Execution is done in left-to-right order, including passing of context. For example ChainUnaryServer(one, two, three) will execute one before two before three, and three will see context changes of one and two.

Types

type Config

type Config struct {
	Network    string `config:"network" desc:"The network must be \"tcp\", \"tcp4\", \"tcp6\", \"unix\" or \"unixpacket\""`
	Addr       string `config:"addr" desc:"format: host:port"`
	Reflection bool   `config:"reflection" desc:"Enable server reflection service"`
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig(key string) *Config

func StdConfig

func StdConfig(key string, optionFunc ...OptionFunc) *Config

func (*Config) Build

func (c *Config) Build() *Server

func (*Config) Path

func (c *Config) Path() string

type OptionFunc

type OptionFunc func(*Config)

func WithServerOption

func WithServerOption(opt ...grpc.ServerOption) OptionFunc

func WithStreamServerInterceptor

func WithStreamServerInterceptor(interceptor ...grpc.StreamServerInterceptor) OptionFunc

func WithUnaryServerInterceptor

func WithUnaryServerInterceptor(interceptor ...grpc.UnaryServerInterceptor) OptionFunc

func WithWrap

func WithWrap(wrap Wrap) OptionFunc

type Server

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

func (*Server) Name

func (server *Server) Name() string

func (*Server) Serve

func (server *Server) Serve(ctx context.Context) error

func (*Server) Shutdown

func (server *Server) Shutdown(ctx context.Context) error

type Wrap

type Wrap func(*grpc.Server)

Directories

Path Synopsis
interceptor

Jump to

Keyboard shortcuts

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