server

package
v0.20.37 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GatewayMux

func GatewayMux() *runtime.ServeMux

GatewayMux creates a gateway multiplexer for serving the API as an OpenAPI endpoint.

func NewGatewayServer

func NewGatewayServer(
	log *zerolog.Logger,
	cfg *config.Common,
	gtwMux *runtime.ServeMux,
	registry promclient.Registerer,
) (*http.Server, error)

NewGatewayServer creates a new gateway server.

Types

type GRPCRegistrations

type GRPCRegistrations func(server *grpc.Server)

GRPCRegistrations represents a function that can register API implementations to the GRPC server.

func CoreServiceRegistrations

func CoreServiceRegistrations(
	implAuthorizerServer *impl.AuthorizerServer,
) GRPCRegistrations

type HTTPRouteRegistrations

type HTTPRouteRegistrations func(mux *http.ServeMux)

HTTPRouteRegistrations represents a function that can register any custom http handler for HTTP server.

type HandlerRegistrations

type HandlerRegistrations func(ctx context.Context, mux *runtime.ServeMux, grpcEndpoint string, opts []grpc.DialOption) error

HandlerRegistrations represents a function that can register handlers for the GRPC Gateway.

type HealthServer

type HealthServer struct {
	Server     *health.Server
	GRPCServer *grpc.Server
}

HealthServer contains everything we need to be able to serve a health status endpoint.

type Server

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

func NewServer

func NewServer(
	ctx context.Context,
	logger *zerolog.Logger,
	cfg *config.Common,
	errGroup *errgroup.Group,
	grpcRegistrations GRPCRegistrations,
	handlerRegistrations HandlerRegistrations,
	gtwServer *http.Server,
	gtwMux *runtime.ServeMux,

) (*Server, func(), error)

func (*Server) AddGRPCServerOptions

func (s *Server) AddGRPCServerOptions(grpcOptions ...grpc.ServerOption)

Adds Server Options to the GRPC server, for example GRPC Unary and Stream middlewares.

func (*Server) RegisterServer

func (s *Server) RegisterServer(name string, start, stop func(ctx context.Context) error)

Registers additional servers to the app, for example, metrics server.

func (*Server) Start

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

func (*Server) Stop

func (s *Server) Stop() error

Stop stops the GRPC and HTTP servers, as well as their health servers.

Jump to

Keyboard shortcuts

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