server

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server rpc server definition

func New

func New(cfg *config.ServerConfig) *Server

New returns a rpc Server instance

func (*Server) ChainUnaryServer

func (s *Server) ChainUnaryServer() grpc.UnaryServerInterceptor

ChainUnaryServer creates a single interceptor out of a chain of many interceptors. 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.

func (*Server) Server

func (s *Server) Server() *grpc.Server

Server returns underlying grpc Server

func (*Server) Start

func (s *Server) Start() net.Addr

Start rpc server

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stops the gRPC server gracefully. It stops the server from accepting new connections and RPCs and blocks until all the pending RPCs are finished.

func (*Server) Use

func (s *Server) Use(interceptors ...grpc.UnaryServerInterceptor)

Use attaches a global interceptor to the server. ie. the interceptor attached through Use() will be included in the interceptors chain for every single request. For example, this is the right place for a logger or error management interceptor.

func (*Server) WithUnaryServerChain

func (s *Server) WithUnaryServerChain() grpc.ServerOption

Chain creates a single interceptor out of a chain of many interceptors. WithUnaryServerChain is a grpc.Server config option that accepts multiple unary interceptors. Basically syntactic sugar.

Jump to

Keyboard shortcuts

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