status

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModule

func NewModule(statusManager Manager) kernel.ModuleFactory

NewModule creates a new module that reports the status from the status manager upon receiving SIGUSR1

Types

type Manager

type Manager interface {
	// initialize a new work item (e.g. working through the files of a day) with the given number of steps (e.g. days) to do
	StartWork(key string, steps int) WorkItem
	// print the report to the logger
	PrintReport(logger log.Logger)
	// monitor execution of a method and set the correct result status upon return
	Monitor(key string, f func() error) func() error
	// like Monitor, but pass along a context
	MonitorWithContext(key string, f func(ctx context.Context) error) func(ctx context.Context) error
}

func NewManager

func NewManager() Manager

func ProvideManager

func ProvideManager() Manager

type WorkItem

type WorkItem interface {
	// monitor execution of a method and set the correct result status upon return
	Monitor(f func() error) func() error
	// update the progress of a work item with the current step and the progress (in %) of that step (e.g. how many files of that day are done?)
	ReportProgress(step int, progress float64)
	// utility to report 100% progress on all steps
	ReportDone()
	// report that a work item failed and the reason for that
	ReportError(err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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