server

package
v0.0.0-...-ebe581b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InitialWindowSize window size, default 128 MB.
	InitialWindowSize int32 = 128 << 20
	// InitialConnWindowSize connection window size, default 64 MB.
	InitialConnWindowSize int32 = 64 << 20
	// ReadBufferSize buffer size, default 32 MB.
	ReadBufferSize = 32 << 20
	// WriteBufferSize write buffer size, default 32 MB.
	WriteBufferSize = 32 << 20
)
View Source
const (
	// MaxRecvMsgSize max message size
	MaxRecvMsgSize = 1024 * 1024 * 1024
	// MaxConcurrentStreams max concurrent
	MaxConcurrentStreams = 1000
	// GRPCTIMEOUT grpc timeout
	GRPCTIMEOUT = 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpServer

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

HttpServer defines gRPC-Gateway for forwarding http requests

func NewHttpServer

func NewHttpServer(conf *config.ExecutorConf) (*HttpServer, error)

NewHttpServer initiates gRPC-Gateway, allowCROS is used to determine whether to allow cross-domain requests

func (*HttpServer) Serve

func (s *HttpServer) Serve() error

Serve starts the gateway and blocks

func (*HttpServer) Stop

func (s *HttpServer) Stop()

Stop exits the gateway service

type Server

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

Server defines grpc server and http server

func New

func New(conf *config.ExecutorConf) (*Server, error)

New creates GRPC and HTTP server which has no service registered and has not started to accept requests yet.

func (*Server) Serve

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

Serve runs Server and blocks current routine

func (*Server) StartGrpcServe

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

startGrpcServe runs GerpcServer, block go-routine until get Stop signal

func (*Server) Stop

func (s *Server) Stop()

Stop when get interrupt signal, stop grpc server and http server

Jump to

Keyboard shortcuts

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