Documentation ¶
Index ¶
- type BasePlugin
- func (b *BasePlugin) BaseInit() error
- func (b *BasePlugin) GetName() PluginName
- func (b *BasePlugin) GetState() PluginState
- func (b *BasePlugin) GetVersion() string
- func (b *BasePlugin) ParseConfig(cfg any) error
- func (b *BasePlugin) RecvEvent() chan *event.Message
- func (b *BasePlugin) SendEvent(to PluginName, action string, data any) error
- func (b *BasePlugin) SetConfig(cfg any)
- type Plugin
- type PluginMetrics
- type PluginName
- type PluginState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasePlugin ¶
type BasePlugin struct { Context context.Context Cancel context.CancelFunc Name PluginName Version string Config any Event *event.Event State PluginState Log *logrus.Entry Mu *sync.RWMutex Stop chan error Pool *ants.Pool }
func (*BasePlugin) BaseInit ¶
func (b *BasePlugin) BaseInit() error
func (*BasePlugin) GetName ¶
func (b *BasePlugin) GetName() PluginName
func (*BasePlugin) GetState ¶
func (b *BasePlugin) GetState() PluginState
func (*BasePlugin) GetVersion ¶
func (b *BasePlugin) GetVersion() string
func (*BasePlugin) ParseConfig ¶
func (b *BasePlugin) ParseConfig(cfg any) error
func (*BasePlugin) RecvEvent ¶
func (b *BasePlugin) RecvEvent() chan *event.Message
func (*BasePlugin) SendEvent ¶
func (b *BasePlugin) SendEvent(to PluginName, action string, data any) error
func (*BasePlugin) SetConfig ¶
func (b *BasePlugin) SetConfig(cfg any)
type Plugin ¶
type Plugin interface { Init() error // init the plugin Run() // run the plugin Stop() // stop the plugin Metrics() *PluginMetrics // stats the plugin Health() PluginState // get the health of the plugin RefreshConfig(cfg any) // refresh the config of the plugin }
type PluginMetrics ¶
type PluginMetrics struct { }
type PluginName ¶
type PluginName string
const (
PluginHealthGreen PluginHealth = "green" PluginHealthYellow PluginHealth = "yellow" PluginHealthRed PluginHealth = "red"
)
type PluginState ¶
type PluginState string
const ( PluginStateCreate PluginState = "create" PluginStateInit PluginState = "init" PluginStateRunning PluginState = "running" PluginStateStopped PluginState = "stopped" PluginStatePaused PluginState = "paused" )
Click to show internal directories.
Click to hide internal directories.