lifecycle

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

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

AfterInit 初始化后

func (*DefaultPluginLifecycleHooks) AfterStart

func (h *DefaultPluginLifecycleHooks) AfterStart(ctx context.Context) error

AfterStart 启动后

func (*DefaultPluginLifecycleHooks) AfterStop

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

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

Start 启动插件

func (*PluginLifecycleManager) Stop

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 状态变更监听器

Jump to

Keyboard shortcuts

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