infra

package
v0.0.0-...-6d8854b Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyProps = "_conf"
)

Variables

View Source
var StarterRegister *starterRegister = new(starterRegister)

Functions

func Register

func Register(s Starter)

func RegisterApi

func RegisterApi(init Initializer)

注册webApi初始化对象

func SystemRun

func SystemRun()

系统基础资源的启动管理

Types

type BaseStarter

type BaseStarter struct{}

基础空启动器实现 为了方便资源启动器的代码实现

func (*BaseStarter) Init

func (b *BaseStarter) Init(ctx StarterContext)

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(conf kvs.ConfigSource) *BootApplication

func (*BootApplication) Start

func (b *BootApplication) Start()

func (*BootApplication) Stop

func (b *BootApplication) Stop()

type Initializer

type Initializer interface {
	// 用于对象实例化后的初始化操作
	Init()
}

初始化接口

func GetApiInitializers

func GetApiInitializers() []Initializer

type InitializerRegister

type InitializerRegister struct {
	Initializers []Initializer
}

初始化注册器

type Starter

type Starter interface {
	// 1.系统启动,初始化一些基础资源
	Init(StarterContext)
	// 2.系统基础资源的安装
	Setup(StarterContext)
	// 3.启动基础资源
	Start(StarterContext)
	// 启动器是否可阻塞
	StartBlocking() bool
	// 4.资源停止和销毁
	Stop(StarterContext)
}

资源启动器接口

func GetStarters

func GetStarters() []Starter

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 (s *WebApiStarter) Setup(ctx StarterContext)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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