Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableMonitors ¶
func AvailableMonitors() []string
AvailableMonitors returns the list of schemes that have been registered with `MonitorInitializeFunc` functions.
func RegisterMonitor ¶
func RegisterMonitor(ctx context.Context, name string, fn MonitorInitializeFunc) error
RegisterMonitor associates a URI scheme with a `MonitorInitializeFunc` initialization function.
Types ¶
type Event ¶
type Event struct {
// The total number of pages being processed
Pages int
// The current page being processed
Page int
// An optional string describing the event
Message string
}
Event defines details about a (picturebook) page being processed.
type Monitor ¶
type Monitor interface {
// Signal() dispatches a processing event to report.
Signal(context.Context, *Event) error
// Clear() resets the progress reporting interface.
Clear() error
// Close() terminates the progress reporter.
Close() error
}
Monitor provides an interface for reporting the progress of a picturebook creation process.
func NewMonitor ¶
NewMonitor returns a new `Monitor` instance for 'uri' whose scheme is expected to have been associated with an `MonitorInitializeFunc` (by the `RegisterMonitor` method.
func NewNullMonitor ¶
NewNullMonitor returns a new `NullMonitor` instance implementing the `Monitor` interface.
type MonitorInitializeFunc ¶
type MonitorInitializeFunc defined a common initialization function for instances implementing the Monitor interface. This is specified when the packages definining those instances call `RegisterMonitor` and invoked with the `NewMonitor` method is called.
type NullMonitor ¶
type NullMonitor struct {
Monitor
}
NullMonitor implements the `Monitor` interface for receiving progress reports but not doing anything with them.
type ProgressBarMonitor ¶
type ProgressBarMonitor struct {
Monitor
// contains filtered or unexported fields
}
ProgressBarMonitor implements the `Monitor` interface for receiving progress reports using the `schollz/progressbar/v3` package.
func (*ProgressBarMonitor) Clear ¶
func (m *ProgressBarMonitor) Clear() error
Clear removes the current progress bar.
func (*ProgressBarMonitor) Close ¶
func (m *ProgressBarMonitor) Close() error
Close terminates the progress bar.