Documentation ¶
Index ¶
- type Server
- func (s *Server) ChainUnaryServer() grpc.UnaryServerInterceptor
- func (s *Server) Server() *grpc.Server
- func (s *Server) Start() net.Addr
- func (s *Server) Stop(ctx context.Context) error
- func (s *Server) Use(interceptors ...grpc.UnaryServerInterceptor)
- func (s *Server) WithUnaryServerChain() grpc.ServerOption
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 (*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) Stop ¶
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.