server

package
v0.0.0-...-c0e02ee Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCServer

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

GRPCServer 代表一个 GRPC 服务器.

func NewGRPCServer

func NewGRPCServer(
	grpcOptions *genericoptions.GRPCOptions,
	tlsOptions *genericoptions.TLSOptions,
	serverRegisterFunc func(grpc.ServiceRegistrar),
	serverOptions []grpc.ServerOption,
) (*GRPCServer, error)

NewGRPCServer 创建一个新的 GRPC 服务器实例.

func (*GRPCServer) GracefulStop

func (s *GRPCServer) GracefulStop(ctx context.Context)

GracefulStop 优雅地关闭 GRPC 服务器.

func (*GRPCServer) RunOrDie

func (s *GRPCServer) RunOrDie()

RunOrDie 启动 GRPC 服务器并在出错时记录致命错误.

type HTTPServer

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

HTTPServer 代表一个 HTTP 服务器.

func NewHTTPServer

func NewHTTPServer(
	httpOptions *genericoptions.HTTPOptions,
	grpcOptions *genericoptions.GRPCOptions,
	tlsOptions *genericoptions.TLSOptions,
	handlerRegisterFunc func(mux *runtime.ServeMux, conn *grpc.ClientConn) error,
) (*HTTPServer, error)

NewHTTPServer 创建一个新的 HTTP 服务器实例.

func (*HTTPServer) GracefulStop

func (s *HTTPServer) GracefulStop(ctx context.Context)

GracefulStop 优雅地关闭 HTTP 服务器.

func (*HTTPServer) RunOrDie

func (s *HTTPServer) RunOrDie()

RunOrDie 启动 HTTP 服务器并在出错时记录致命错误.

type Server

type Server interface {
	RunOrDie()
	GracefulStop(ctx context.Context)
}

Server 定义了所有服务器类型的接口.

Jump to

Keyboard shortcuts

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