status

package
v0.71.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 10 Imported by: 1 module, 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

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(ctx context.Context, 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