controlhooks

package
v0.14.0-alpha.5.pg14 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NullHooks = &NullControlHook{}

Functions

func AddControlHooksToContext

func AddControlHooksToContext(ctx context.Context, statusHooks ControlHooks) context.Context

func OnControlEvent

func OnControlEvent(ctx context.Context, p *ControlProgress)

func OnDone

func OnDone(ctx context.Context, p *ControlProgress)

func OnStart

func OnStart(ctx context.Context, p *ControlProgress)

Types

type ControlHooks

type ControlHooks interface {
	OnStart(context.Context, *ControlProgress)
	OnControlEvent(context.Context, *ControlProgress)
	OnDone(context.Context, *ControlProgress)
}

func ControlHooksFromContext

func ControlHooksFromContext(ctx context.Context) ControlHooks

type ControlProgress

type ControlProgress struct {
	Total     int `json:"total"`
	Pending   int `json:"pending"`
	Complete  int `json:"complete"`
	Error     int `json:"error"`
	Executing int `json:"executing"`
	// contains filtered or unexported fields
}

func NewControlProgress

func NewControlProgress(total int) *ControlProgress

func (*ControlProgress) Finish

func (p *ControlProgress) Finish(ctx context.Context)

func (*ControlProgress) OnControlComplete

func (p *ControlProgress) OnControlComplete(ctx context.Context)

func (*ControlProgress) OnControlError

func (p *ControlProgress) OnControlError(ctx context.Context)

func (*ControlProgress) OnControlFinish

func (p *ControlProgress) OnControlFinish(ctx context.Context)

func (*ControlProgress) OnControlStart

func (p *ControlProgress) OnControlStart(ctx context.Context, control *modconfig.Control)

func (*ControlProgress) Start

func (p *ControlProgress) Start(ctx context.Context)

type ControlStatusHooks

type ControlStatusHooks struct {
	Enabled bool
}

ControlStatusHooks is a struct which implements ControlHooks, and displays the control progress as a status message

func NewControlStatusHooks

func NewControlStatusHooks() *ControlStatusHooks

func (*ControlStatusHooks) OnControlEvent

func (c *ControlStatusHooks) OnControlEvent(ctx context.Context, p *ControlProgress)

func (*ControlStatusHooks) OnDone

func (*ControlStatusHooks) OnStart

func (c *ControlStatusHooks) OnStart(ctx context.Context, _ *ControlProgress)

type NullControlHook

type NullControlHook struct{}

func (*NullControlHook) OnControlEvent

func (*NullControlHook) OnControlEvent(context.Context, *ControlProgress)

func (*NullControlHook) OnDone

func (*NullControlHook) OnStart

Jump to

Keyboard shortcuts

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