runner

package module
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package runner starts and stops lifecycle resources wired via sdi.

After github.com/omcrgnt/sdi.Resolve, Runner receives []Starter and []Closer (registration order). Runner.Run starts every starter concurrently with a lifecycle context derived from the run context. The lifecycle context is canceled on starter failure (fail-fast) or when the parent run context is canceled; it is not canceled when Runner.Run returns after starters that exit Start without blocking (e.g. background servers). Starters that block until shutdown should wait on the lifecycle context passed to Start. Runner.Stop releases the lifecycle cancel func and closes every closer in reverse registration order.

Register *Runner via github.com/omcrgnt/runner/use (Fixed on unique.Global). github.com/omcrgnt/app.App receives Runner through DI and calls Run/Stop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Closer

type Closer interface {
	Close(ctx context.Context) error
}

type Runner added in v0.20.1

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

Runner starts Starter and stops Closer resources injected via sdi after [Deps].

func (*Runner) Deps added in v0.21.0

func (r *Runner) Deps() []any

func (*Runner) Inject added in v0.21.0

func (r *Runner) Inject(args []any)

func (*Runner) Run added in v0.20.1

func (r *Runner) Run(ctx context.Context) error

func (*Runner) Stop added in v0.20.1

func (r *Runner) Stop(ctx context.Context) error

type Starter

type Starter interface {
	Start(ctx context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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