Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lifecycle ¶
type Lifecycle interface {
// Start starts the component.
// This method must be non-blocking.
// The context is used for the start operation itself (e.g., timeout), not the application lifecycle.
Start(ctx context.Context) error
// Stop stops the component.
// This method must be non-blocking.
// The context is used for the stop operation itself (e.g., timeout), not the application lifecycle.
Stop(ctx context.Context) error
}
Lifecycle represents a component that has a distinct start and stop phase.
type Option ¶
type Option func(*adapter)
Option configures the adapter.
func WithStartTimeout ¶
WithStartTimeout sets the timeout for the Start operation.
func WithStopTimeout ¶
WithStopTimeout sets the timeout for the Stop operation.
type Runnable ¶
type Runnable interface {
// Run starts the process.
// The context passed to Run is the application lifecycle context.
// Run must block until the context is canceled or a fatal error occurs.
Run(ctx context.Context) error
}
Runnable represents a long-running process that blocks until the context is canceled or an error occurs.
func ToRunnable ¶
ToRunnable converts a Lifecycle to a Runnable. It handles the start and stop sequence, respecting the application lifecycle context.
Click to show internal directories.
Click to hide internal directories.