runtime

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: GPL-3.0 Imports: 4 Imported by: ? 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 runtime contains optional lifecycle, scheduling and worker helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

type Hook func(context.Context) error

Hook performs one lifecycle action.

type Lifecycle

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

Lifecycle runs registered startup and shutdown hooks in order.

func (*Lifecycle) AfterStop

func (l *Lifecycle) AfterStop(h Hook)

func (*Lifecycle) BeforeStart

func (l *Lifecycle) BeforeStart(h Hook)

func (*Lifecycle) RunAfterStop

func (l *Lifecycle) RunAfterStop(ctx context.Context) error

func (*Lifecycle) RunBeforeStart

func (l *Lifecycle) RunBeforeStart(ctx context.Context) error

type Runner

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

func NewRunner

func NewRunner(a *app.App) *Runner

func (*Runner) Run

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

type ScheduledJob

type ScheduledJob struct {
	Name     string
	Interval time.Duration
	Run      func(context.Context)
}

ScheduledJob describes a fixed-interval background task.

type Scheduler

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

Scheduler runs registered jobs until its context is canceled.

func NewScheduler

func NewScheduler() *Scheduler

func (*Scheduler) Every

func (s *Scheduler) Every(name string, interval time.Duration, fn func(context.Context))

func (*Scheduler) Start

func (s *Scheduler) Start(ctx context.Context)

type WorkerPool

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

WorkerPool limits concurrent background functions and waits for completion.

func NewWorkerPool

func NewWorkerPool(size int) *WorkerPool

NewWorkerPool creates a pool with at least one worker slot.

func (*WorkerPool) Go

func (p *WorkerPool) Go(fn func())

func (*WorkerPool) Wait

func (p *WorkerPool) Wait()

Jump to

Keyboard shortcuts

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