restore

package
v1.0.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 5 Imported by: 1 module, 1 package

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

Index

Constants

View Source
const DelayFieldName = "runner.middleware.restore.delay"

DelayFieldName — имя поля для задержки между попытками.

Variables

View Source
var Component = compogo.Component{
	Name: "runner.middleware.restore",
	Dependencies: compogo.Components{
		&runner.Component,
	},
	Init: compogo.StepFunc(func(container compogo.Container) error {
		return container.Provides(NewConfig, NewRestore)
	}),
	BindFlags: compogo.BindFlags(func(flagSet flag.FlagSet, container compogo.Container) error {
		return container.Invoke(func(config *Config) {
			flagSet.DurationVar(&config.Delay, DelayFieldName, DelayDefault, "")
		})
	}),
	Configuration: compogo.StepFunc(func(container compogo.Container) error {
		return container.Invoke(Configuration)
	}),
	PreExecute: compogo.StepFunc(func(container compogo.Container) error {
		return container.Invoke(func(r runner.Runner, middleware *Restore) {
			r.Use(middleware)
		})
	}),
}

Component — компонент middleware восстановления для runner.Runner.

View Source
var DelayDefault = 100 * time.Millisecond

DelayDefault — задержка по умолчанию (100 мс).

Functions

This section is empty.

Types

type Config

type Config struct {
	Delay time.Duration
}

Config содержит конфигурацию middleware восстановления.

func Configuration

func Configuration(config *Config, configurator compogo.Configurator) *Config

Configuration загружает конфигурацию из Configurator.

func NewConfig

func NewConfig() *Config

NewConfig создаёт новую конфигурацию.

type Restore

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

Restore — middleware для автоматического восстановления процессов. При ошибке выполнения процесса перезапускает его с задержкой. Работает до тех пор, пока не будет отменён контекст.

func NewRestore

func NewRestore(config *Config, runner runner.Runner) *Restore

func (*Restore) Middleware

func (restore *Restore) Middleware(_ runner.Process, next runner.ProcessFunc) runner.ProcessFunc

Jump to

Keyboard shortcuts

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