server

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package server is a server builder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCOptions added in v0.1.6

type GRPCOptions struct {
	Addr       string
	MaxMsgSize int `mapstructure:"max-msg-size"`
}

GRPCOptions defines options for building a GRPCServer.

type GRPCServer

type GRPCServer struct {
	*grpc.Server
	// contains filtered or unexported fields
}

func NewGRPCServer added in v0.1.5

func NewGRPCServer() (*GRPCServer, error)

NewGRPCServer builds an GRPCServer.

func (*GRPCServer) Run

func (s *GRPCServer) Run() error

Run runs the HTTP server and conducts a self health check.

func (*GRPCServer) Shutdown

func (s *GRPCServer) Shutdown(_ context.Context) error

Shutdown shuts down the HTTP server.

type HTTPOptions added in v0.1.6

type HTTPOptions struct {
	Mode        string
	Addr        string
	Middlewares []string
	PingTimeout time.Duration `mapstructure:"ping-timeout"`
	Healthz     bool
	Metrics     bool
	Profiling   bool
}

HTTPOptions defines options for building an HTTPServer.

type HTTPServer

type HTTPServer struct {
	*gin.Engine
	// contains filtered or unexported fields
}

HTTPServer is both a HTTPServer and a gin.Engine.

func NewHTTPServer added in v0.1.5

func NewHTTPServer() (*HTTPServer, error)

NewHTTPServer builds an HTTPServer.

func (*HTTPServer) Run

func (s *HTTPServer) Run() error

Run runs the HTTP server and conducts a self health check.

func (*HTTPServer) Shutdown

func (s *HTTPServer) Shutdown(ctx context.Context) error

Shutdown shuts down the HTTP server.

type Option added in v0.3.0

type Option interface {
	// contains filtered or unexported methods
}

Option configures the server.

func WithGRPC added in v0.3.0

func WithGRPC() Option

func WithShutdown added in v0.3.0

func WithShutdown(sd shutdown.ShutdownFunc) Option

type OptionFunc added in v0.3.0

type OptionFunc func(*Server)

OptionFunc wraps a func so it satisfies the Option interface.

type Servable

type Servable interface {
	Run() error
	Shutdown(context.Context) error
}

Servable defines the behavior of a server.

type Server

type Server struct {
	Name       string
	HTTPServer *HTTPServer
	GRPCServer *GRPCServer
	// contains filtered or unexported fields
}

Server defines the structure of a server.

func NewServer

func NewServer(name string, opts ...Option) (*Server, error)

func (*Server) Run

func (s *Server) Run() error

Jump to

Keyboard shortcuts

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