lifecycle

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lifecycle provides application lifecycle management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterShutdownListener

func RegisterShutdownListener(
	shutdownlistener *internalhelper.ShutdownListener,
	lifecycle fx.Lifecycle,
)

RegisterShutdownListener registers the shutdown listener in the lifecycle.

Types

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor is a struct that schedules and manages the execution of runners. It uses a WaitGroup to wait for all runners to finish before stopping.

func NewExecutor

func NewExecutor(
	lifecycle fx.Lifecycle,
	runners []Runner,
	logger *slog.Logger,
) *Executor

NewExecutor creates a new Executor instance.

type Runner

type Runner interface {
	// Name returns the name of the runner.
	// It's only for debugging & logging purposes.
	Name() string

	// Run starts the runner with the given context.
	Run(ctx context.Context) error
}

Runner is an interface that defines a runner that can be started with a context.

Jump to

Keyboard shortcuts

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