Documentation ¶
Overview ¶
Package lifecycle provides interfaces and types for managing the lifecycle of components.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseLifecycle ¶
type BaseLifecycle struct{}
BaseLifecycle provides a default implementation of the Lifecycle interface.
func (*BaseLifecycle) Init ¶
func (*BaseLifecycle) Init(context.Context) error
Init implements the Init method of the Lifecycle interface.
func (*BaseLifecycle) Shutdown ¶
func (*BaseLifecycle) Shutdown(context.Context) error
Shutdown implements the Shutdown method of the Lifecycle interface.
type Funcs ¶
type Funcs struct { Init func(context.Context) error Start func(context.Context) error Shutdown func(context.Context) error Uninit func(context.Context) error }
Funcs represents a set of lifecycle functions for a simple component.
type Lifecycle ¶
type Lifecycle interface { // Init initializes the component. Init(context.Context) error // Uninit performs cleanup after the component is no longer needed. Uninit(context.Context) error // Start begins the component's main operations. Start(context.Context) error // Shutdown gracefully stops the component's operations. Shutdown(context.Context) error }
Lifecycle defines the interface for components with lifecycle management.
type Status ¶
type Status int
Status represents the lifecycle state of a component.
const ( // Created indicates that the component has been instantiated but not yet initialized. Created Status = iota // Starting indicates that the component is in the process of starting. Starting // Running indicates that the component is fully operational. Running // Stopping indicates that the component is in the process of shutting down. Stopping // Closed indicates that the component has been fully shut down. Closed )
Click to show internal directories.
Click to hide internal directories.