Documentation ¶
Index ¶
- Constants
- Variables
- func Register(s Starter)
- func RegisterApi(ai Initializer)
- func SystemRun()
- type BaseStarter
- func (b *BaseStarter) Init(ctx StarterContext)
- func (b *BaseStarter) Priority() int
- func (b *BaseStarter) PriorityGroup() PriorityGroup
- func (b *BaseStarter) Setup(ctx StarterContext)
- func (b *BaseStarter) Start(ctx StarterContext)
- func (b *BaseStarter) StartBlocking() bool
- func (b *BaseStarter) Stop(ctx StarterContext)
- type BootApplication
- type InitializeRegister
- type Initializer
- type PriorityGroup
- type Starter
- type StarterContext
- type WebApiStarter
Constants ¶
View Source
const (
KeyProps = "_config"
)
Variables ¶
View Source
var StarterRegister *starterRegister = new(starterRegister)
Functions ¶
Types ¶
type BaseStarter ¶
type BaseStarter struct { }
基础空启动器实现 - 结构体
func (*BaseStarter) Priority ¶
func (b *BaseStarter) Priority() int
func (*BaseStarter) PriorityGroup ¶
func (b *BaseStarter) PriorityGroup() PriorityGroup
func (*BaseStarter) Setup ¶
func (b *BaseStarter) Setup(ctx StarterContext)
func (*BaseStarter) Start ¶
func (b *BaseStarter) Start(ctx StarterContext)
func (*BaseStarter) StartBlocking ¶
func (b *BaseStarter) StartBlocking() bool
func (*BaseStarter) Stop ¶
func (b *BaseStarter) Stop(ctx StarterContext)
type BootApplication ¶
type BootApplication struct {
// contains filtered or unexported fields
}
应用程序启动管理器
func New ¶
func New(config kvs.ConfigSource) *BootApplication
func (*BootApplication) Start ¶
func (b *BootApplication) Start()
type InitializeRegister ¶
type InitializeRegister struct {
Initializers []Initializer
}
初始化注册器
func (*InitializeRegister) Register ¶
func (i *InitializeRegister) Register(ai Initializer)
注册一个初始化对象
type Initializer ¶
type Initializer interface {
// 用于对象实例化后的初始化操作
Init()
}
type PriorityGroup ¶
type PriorityGroup int
const ( SystemGroup PriorityGroup = 30 BasicResourcesGroup PriorityGroup = 20 AppGroup PriorityGroup = 10 INT_MAX = int(^uint(0) >> 1) DEFAULT_PRIORITY = 10000 )
type Starter ¶
type Starter interface { // 1. 系统启动,初始化一些基础资源 Init(StarterContext) // 2. 系统基础资源的安装 Setup(StarterContext) // 3. 启动基础资源 Start(StarterContext) // 4. 资源停止和销毁 Stop(StarterContext) // 启动器是否可阻塞 StartBlocking() bool }
基础资源启动器接口
type StarterContext ¶
type StarterContext map[string]interface{}
基础资源上下文结构体
func (StarterContext) Props ¶
func (s StarterContext) Props() kvs.ConfigSource
type WebApiStarter ¶
type WebApiStarter struct {
BaseStarter
}
func (*WebApiStarter) Setup ¶
func (w *WebApiStarter) Setup(ctx StarterContext)
Click to show internal directories.
Click to hide internal directories.