Documentation
¶
Index ¶
- type DefaultPluginLifecycleHooks
- func (h *DefaultPluginLifecycleHooks) AfterInit(ctx context.Context) error
- func (h *DefaultPluginLifecycleHooks) AfterStart(ctx context.Context) error
- func (h *DefaultPluginLifecycleHooks) AfterStop(ctx context.Context) error
- func (h *DefaultPluginLifecycleHooks) BeforeInit(ctx context.Context, config api.PluginConfig) error
- func (h *DefaultPluginLifecycleHooks) BeforeStart(ctx context.Context) error
- func (h *DefaultPluginLifecycleHooks) BeforeStop(ctx context.Context) error
- type PluginLifecycleHooks
- type PluginLifecycleManager
- func (m *PluginLifecycleManager) AddStateChangeListener(listener StateChangeListener)
- func (m *PluginLifecycleManager) Close() error
- func (m *PluginLifecycleManager) GetCurrentState() api.PluginState
- func (m *PluginLifecycleManager) Init(ctx context.Context) error
- func (m *PluginLifecycleManager) IsActive() bool
- func (m *PluginLifecycleManager) IsHealthy() bool
- func (m *PluginLifecycleManager) SetHooks(hooks PluginLifecycleHooks)
- func (m *PluginLifecycleManager) Start(ctx context.Context) error
- func (m *PluginLifecycleManager) Stop(ctx context.Context) error
- func (m *PluginLifecycleManager) TransitionTo(state api.PluginState, metadata map[string]interface{}) error
- type StateChangeListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultPluginLifecycleHooks ¶
type DefaultPluginLifecycleHooks struct {
// contains filtered or unexported fields
}
DefaultPluginLifecycleHooks 默认插件生命周期钩子
func (*DefaultPluginLifecycleHooks) AfterInit ¶
func (h *DefaultPluginLifecycleHooks) AfterInit(ctx context.Context) error
AfterInit 初始化后
func (*DefaultPluginLifecycleHooks) AfterStart ¶
func (h *DefaultPluginLifecycleHooks) AfterStart(ctx context.Context) error
AfterStart 启动后
func (*DefaultPluginLifecycleHooks) AfterStop ¶
func (h *DefaultPluginLifecycleHooks) AfterStop(ctx context.Context) error
AfterStop 停止后
func (*DefaultPluginLifecycleHooks) BeforeInit ¶
func (h *DefaultPluginLifecycleHooks) BeforeInit(ctx context.Context, config api.PluginConfig) error
BeforeInit 初始化前
func (*DefaultPluginLifecycleHooks) BeforeStart ¶
func (h *DefaultPluginLifecycleHooks) BeforeStart(ctx context.Context) error
BeforeStart 启动前
func (*DefaultPluginLifecycleHooks) BeforeStop ¶
func (h *DefaultPluginLifecycleHooks) BeforeStop(ctx context.Context) error
BeforeStop 停止前
type PluginLifecycleHooks ¶
type PluginLifecycleHooks interface {
// BeforeInit 初始化前
BeforeInit(ctx context.Context, config api.PluginConfig) error
// AfterInit 初始化后
AfterInit(ctx context.Context) error
// BeforeStart 启动前
BeforeStart(ctx context.Context) error
// AfterStart 启动后
AfterStart(ctx context.Context) error
// BeforeStop 停止前
BeforeStop(ctx context.Context) error
// AfterStop 停止后
AfterStop(ctx context.Context) error
}
PluginLifecycleHooks 插件生命周期钩子
type PluginLifecycleManager ¶
type PluginLifecycleManager struct {
// contains filtered or unexported fields
}
PluginLifecycleManager 插件生命周期管理器 管理插件的生命周期状态
func NewPluginLifecycleManager ¶
func NewPluginLifecycleManager(plugin api.Plugin, config api.PluginConfig, logger hclog.Logger) *PluginLifecycleManager
NewPluginLifecycleManager 创建一个新的插件生命周期管理器
func (*PluginLifecycleManager) AddStateChangeListener ¶
func (m *PluginLifecycleManager) AddStateChangeListener(listener StateChangeListener)
AddStateChangeListener 添加状态变更监听器
func (*PluginLifecycleManager) Close ¶
func (m *PluginLifecycleManager) Close() error
Close 关闭生命周期管理器
func (*PluginLifecycleManager) GetCurrentState ¶
func (m *PluginLifecycleManager) GetCurrentState() api.PluginState
GetCurrentState 获取当前状态
func (*PluginLifecycleManager) Init ¶
func (m *PluginLifecycleManager) Init(ctx context.Context) error
Init 初始化插件
func (*PluginLifecycleManager) IsActive ¶
func (m *PluginLifecycleManager) IsActive() bool
IsActive 是否处于活动状态
func (*PluginLifecycleManager) IsHealthy ¶
func (m *PluginLifecycleManager) IsHealthy() bool
IsHealthy 是否处于健康状态
func (*PluginLifecycleManager) SetHooks ¶
func (m *PluginLifecycleManager) SetHooks(hooks PluginLifecycleHooks)
SetHooks 设置生命周期钩子
func (*PluginLifecycleManager) Start ¶
func (m *PluginLifecycleManager) Start(ctx context.Context) error
Start 启动插件
func (*PluginLifecycleManager) Stop ¶
func (m *PluginLifecycleManager) Stop(ctx context.Context) error
Stop 停止插件
func (*PluginLifecycleManager) TransitionTo ¶
func (m *PluginLifecycleManager) TransitionTo(state api.PluginState, metadata map[string]interface{}) error
TransitionTo 转换到指定状态
type StateChangeListener ¶
type StateChangeListener func(oldState, newState api.PluginState, metadata map[string]interface{})
StateChangeListener 状态变更监听器
Click to show internal directories.
Click to hide internal directories.