server

package
v0.0.0-...-3030a97 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	Add(...Runnable)
	Start(context.Context) error
	Shutdown(ctx context.Context) error
}

type OptionFunc

type OptionFunc func(*options)

func WithGracefulShutdownTimeout

func WithGracefulShutdownTimeout(timeout int64) OptionFunc

type Runnable

type Runnable interface {
	fmt.Stringer
	// Start 启动
	Start(ctx context.Context) error
	// Attempt 是否允许启动
	Attempt() bool
}

type Server

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

func New

func New(opts ...OptionFunc) *Server

New 实例化

func (*Server) Add

func (e *Server) Add(r ...Runnable)

Add 添加 runnable

func (*Server) Shutdown

func (e *Server) Shutdown(ctx context.Context) (err error)

func (*Server) Start

func (e *Server) Start(ctx context.Context) (err error)

Start 启动 runnable

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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