server

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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