component

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

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ComponentNotImplemented = errors.New("Component Not Implemented")

Functions

func SetLogLevel

func SetLogLevel(level log.Level)

Types

type Component

type Component interface {
	Create(*ComponentInstConfig) (interface{}, error)
	Init(inst interface{}, c *ComponentInstConfig) error
	Start(inst interface{}, c *ComponentInstConfig) error
	Stop(inst interface{}, c *ComponentInstConfig) error
	Update(inst interface{}, c *ComponentInstConfig) error
	Destroy(inst interface{}, c *ComponentInstConfig) error
}

type ComponentInstConfig

type ComponentInstConfig struct {
	CompID string // 组件ID
	Name   string // 实例名称
	Config *pbconfig.Configor
}

type DefaultComponent

type DefaultComponent struct{}

默认组件实现

func (*DefaultComponent) Create

func (dfc *DefaultComponent) Create(*ComponentInstConfig) (interface{}, error)

func (*DefaultComponent) Destroy

func (dfc *DefaultComponent) Destroy(inst interface{}, c *ComponentInstConfig) error

func (*DefaultComponent) Init

func (dfc *DefaultComponent) Init(inst interface{}, c *ComponentInstConfig) error

func (*DefaultComponent) Start

func (dfc *DefaultComponent) Start(inst interface{}, c *ComponentInstConfig) error

func (*DefaultComponent) Stop

func (dfc *DefaultComponent) Stop(inst interface{}, c *ComponentInstConfig) error

func (*DefaultComponent) Update

func (dfc *DefaultComponent) Update(inst interface{}, c *ComponentInstConfig) error

type PBC

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

keywea component

func NewPBC

func NewPBC() *PBC

func (*PBC) CreateInstance

func (pb *PBC) CreateInstance(instConfig *ComponentInstConfig) (interface{}, error)

组件实例

func (*PBC) DestroyAll

func (pb *PBC) DestroyAll() error

func (*PBC) DestroyInstance

func (pb *PBC) DestroyInstance(name string) error

实例销毁

func (*PBC) Init

func (pb *PBC) Init(instConfigs []*ComponentInstConfig) error

func (*PBC) InitInstance

func (pb *PBC) InitInstance(name string) error

实例初始化

func (*PBC) Instance

func (pb *PBC) Instance(name string) interface{}

获取实例

func (*PBC) RegisterComponent

func (pb *PBC) RegisterComponent(compID string, comp Component) error

注册组件

func (*PBC) StartInstance

func (pb *PBC) StartInstance(name string) error

实例启动

func (*PBC) StopInstance

func (pb *PBC) StopInstance(name string) error

实例停止

func (*PBC) UpdateInstance

func (pb *PBC) UpdateInstance(name string, instConfig *ComponentInstConfig) error

实例更新

Jump to

Keyboard shortcuts

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