Documentation
¶
Overview ¶
Package plugin 本包统一插件的机制
Index ¶
Constants ¶
View Source
const ( // SUPPORT_ARGS 命令行参数支持 SUPPORT_ARGS uint32 = 0x0 // SUPPORT_LOGGER 所有的日志支持 SUPPORT_LOGGER uint32 = 0x10 SUPPORT_STDLOG uint32 = 0x12 SUPPORT_ACCESSLOG uint32 = 0x14 SUPPORT_ERRORLOG uint32 = 0x16 // SUPPORT_CONFIG_OBJ 所有配置文件功能的支持 SUPPORT_CONFIG_OBJ uint32 = 0x100 // SUPPORT_RAW_CONFIG 原生的配置文件接口,原型:io.ReadWriteCloser SUPPORT_RAW_CONFIG uint32 = 0x110 // SUPPORT_RAW_FILE 原生的*os.File支持 SUPPORT_RAW_FILE uint32 = 0x120 )
插件需要的支持
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// 原生的资源对象
RawSource *Source
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext() *Context
func (*Context) RangeAllPlugin ¶
RangeAllPlugin 遍历所有注册的插件
func (*Context) RangeArgsPlugin ¶
RangeArgsPlugin 遍历支持参数的插件列表
func (*Context) RegisterRaw ¶
type Plugin ¶
type Plugin interface {
// Start 插件启动时调用的方法
Start(args []string)
// Caller 接收到信号时调用的方法
Caller(single Single)
// GetName 主程序获取插件的名字
GetName() string
// GetType 主程序获取插件的类型
GetType() Type
// GetSupport 主程序获取插件需要的支持
GetSupport() []uint32
// SetSource 设置插件需要的Source
SetSource(source *Source)
}
Plugin 插件的插入要实现的接口
type Source ¶
type Source struct {
Config *config.AutoGenerated
// 原生配置文件接口
RawConfig io.ReadWriteCloser
// 原生文件
RawFile *os.File
AccessLog bilog.Logger
ErrorLog bilog.Logger
StdLog bilog.Logger
}
Source 插件使用到的资源定义 根据需求注册
func (*Source) GetConfigReadWriter ¶
func (s *Source) GetConfigReadWriter() io.ReadWriter
func (*Source) GetConfigReader ¶
func (*Source) GetConfigWriter ¶
Click to show internal directories.
Click to hide internal directories.