kernel

package
v0.0.0-...-34841a2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	EnableSentry bool
}

type Engine

type Engine struct {
	Ctx    context.Context
	Cancel context.CancelFunc

	inject.Injector
	// contains filtered or unexported fields
}

func New

func New(config ...Config) *Engine

func (*Engine) Init

func (e *Engine) Init()

func (*Engine) RegMod

func (e *Engine) RegMod(mods ...Module)

func (*Engine) Serve

func (e *Engine) Serve()

func (*Engine) StartModule

func (e *Engine) StartModule() error

func (*Engine) Stop

func (e *Engine) Stop() error

type Hub

type Hub struct {
	inject.Injector
	Log *zap.SugaredLogger
}

type Module

type Module interface {
	Name() string
	Config() any
	PreInit(*Hub) error
	Init(*Hub) error
	PostInit(*Hub) error
	Load(*Hub) error
	Start(*Hub) error
	Stop(wg *sync.WaitGroup, ctx context.Context) error
	// contains filtered or unexported methods
}

type UnimplementedModule

type UnimplementedModule struct {
}

UnimplementedModule 由于Module接口中的方法除Name外都是可选的,所以这里提供一个默认实现,方便开发者只实现需要的方法

func (*UnimplementedModule) Config

func (u *UnimplementedModule) Config() any

func (*UnimplementedModule) Init

func (u *UnimplementedModule) Init(*Hub) error

func (*UnimplementedModule) Load

func (u *UnimplementedModule) Load(*Hub) error

func (*UnimplementedModule) Name

func (u *UnimplementedModule) Name() string

func (*UnimplementedModule) PostInit

func (u *UnimplementedModule) PostInit(*Hub) error

func (*UnimplementedModule) PreInit

func (u *UnimplementedModule) PreInit(*Hub) error

func (*UnimplementedModule) Start

func (u *UnimplementedModule) Start(*Hub) error

func (*UnimplementedModule) Stop

Jump to

Keyboard shortcuts

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