manager

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRecover = 3

Variables

This section is empty.

Functions

This section is empty.

Types

type IDGenerator

type IDGenerator func(string) int

type Manager

type Manager struct {
	Quit chan bool // Channel to signal that the manager is done
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *Manager

func (*Manager) AddUnit

func (m *Manager) AddUnit(unit WorkUnit, name string) *WorkUnitManager

func (*Manager) Shutdown

func (m *Manager) Shutdown()

func (*Manager) ShutdownOn

func (m *Manager) ShutdownOn(sig ...os.Signal)

func (*Manager) Start

func (m *Manager) Start()

func (*Manager) Units

func (m *Manager) Units() map[string]WorkUnit

type UnitManager

type UnitManager interface {
	ShouldStop() <-chan bool
	Done()
	Panic(any)

	RequestShutdown()
}

The UnitManager interface is used to manage a unit of work. The ShouldStop method returns a channel that will be closed when the unit should stop. The Done method should be called when the unit is done.

type WorkUnit

type WorkUnit interface {
	Run(UnitManager)
}

The WorkUnit interface is used to define a unit of work. The Run method will be called in a goroutine.

type WorkUnitManager

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

func (*WorkUnitManager) Done

func (w *WorkUnitManager) Done()

func (*WorkUnitManager) Panic

func (w *WorkUnitManager) Panic(val any)

func (*WorkUnitManager) RequestShutdown

func (m *WorkUnitManager) RequestShutdown()

func (*WorkUnitManager) SetRecoverable added in v1.2.0

func (wu *WorkUnitManager) SetRecoverable()

func (*WorkUnitManager) ShouldStop

func (w *WorkUnitManager) ShouldStop() <-chan bool

Jump to

Keyboard shortcuts

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