Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // Addr is the network address to listen on. Addr string // CMuxReadTimeout bounds the amount of time spent muxing connections between // gRPC and HTTP. A zero-value specifies unbounded muxing. CMuxReadTimeout time.Duration // LameDuckDuration specifies the length of the lame duck period during // graceful shutdown. If non-zero, the Server will mark itself unhealthy to // stop new incoming connections while continuing to serve existing // connections. LameDuckDuration time.Duration // AllowReflection specifies whether to register the gRPC server for // reflection. This is required to use with tools like grpc_cli. AllowReflection bool // EnableTracing specifies whether to install opentracing interceptors on // the gRPC server. EnableTracing bool // Services is a list of service names to declare as SERVING in health // checks. Names should be fully-qualified (package_name.service_name, e.g. // vtadmin.VTAdminServer, not VTAdminServer), and must be unique for a // single Server instance. Users of this package are responsible for // ensuring they do not pass a list with duplicate service names. // // The service name "grpc.health.v1.Health" is reserved by this package in // order to power the healthcheck service. Attempting to pass this in the // Services list to a grpcserver will be ignored. // // See https://github.com/grpc/grpc/blob/7324556353e831c57d30973db33df489c3ed3576/doc/health-checking.md // for more details on healthchecking. Services []string }
Options defines the set of configurations for a gRPC server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides a multiplexed gRPC/HTTP server.
func New ¶
New returns a new server. See Options for documentation on configuration options.
The underlying gRPC server always has the following interceptors:
- prometheus
- recovery: this handles recovering from panics.
func (*Server) GRPCServer ¶
GRPCServer returns the gRPC Server.
func (*Server) ListenAndServe ¶
ListenAndServe sets up a listener, multiplexes it into gRPC and non-gRPC requests, and binds the gRPC server and mux.Router to them, respectively. It then installs a signal handler on SIGTERM and SIGQUIT, and runs until either a signal or an unrecoverable error occurs.
On shutdown, it may begin a lame duck period (see Options) before beginning a graceful shutdown of the gRPC server and closing listeners.
func (*Server) MustListenAndServe ¶
func (s *Server) MustListenAndServe()
MustListenAndServe calls ListenAndServe and panics if an error occurs.