Documentation
¶
Index ¶
- type LifecycleManager
- func (lm *LifecycleManager) AddShutdownHook(hook func() error)
- func (lm *LifecycleManager) AddStartupHook(hook func() error)
- func (lm *LifecycleManager) GetShutdownContext() context.Context
- func (lm *LifecycleManager) GracefulShutdown(timeout time.Duration) error
- func (lm *LifecycleManager) Run() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LifecycleManager ¶
type LifecycleManager struct {
// contains filtered or unexported fields
}
LifecycleManager 应用生命周期管理器
func NewLifecycleManager ¶
func NewLifecycleManager(_ interface{}) *LifecycleManager
NewLifecycleManager 创建生命周期管理器
func (*LifecycleManager) AddShutdownHook ¶
func (lm *LifecycleManager) AddShutdownHook(hook func() error)
AddShutdownHook 添加关闭钩子
func (*LifecycleManager) AddStartupHook ¶
func (lm *LifecycleManager) AddStartupHook(hook func() error)
AddStartupHook 添加启动钩子
func (*LifecycleManager) GetShutdownContext ¶
func (lm *LifecycleManager) GetShutdownContext() context.Context
GetShutdownContext 获取关闭上下文
func (*LifecycleManager) GracefulShutdown ¶
func (lm *LifecycleManager) GracefulShutdown(timeout time.Duration) error
GracefulShutdown 优雅关闭(简化版本)
Click to show internal directories.
Click to hide internal directories.