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)
}
Click to show internal directories.
Click to hide internal directories.