controlstatus

package
v0.14.0-alpha.20 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: AGPL-3.0 Imports: 8 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 OnComplete

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

func OnControlComplete

func OnControlComplete(ctx context.Context, controlRun ControlRunStatusProvider, p *ControlProgress)

func OnControlError

func OnControlError(ctx context.Context, controlRun ControlRunStatusProvider, p *ControlProgress)

func OnControlStart

func OnControlStart(ctx context.Context, controlRun ControlRunStatusProvider, p *ControlProgress)

func OnStart

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

Types

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"`
	StatusSummaries *StatusSummary `json:"summary"`
	// 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, controlRun ControlRunStatusProvider)

func (*ControlProgress) OnControlError

func (p *ControlProgress) OnControlError(ctx context.Context, controlRun ControlRunStatusProvider)

func (*ControlProgress) OnControlStart

func (p *ControlProgress) OnControlStart(ctx context.Context, controlRun ControlRunStatusProvider)

func (*ControlProgress) Start

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

type ControlRunStatus

type ControlRunStatus uint32
const (
	ControlRunReady ControlRunStatus = 1 << iota
	ControlRunStarted
	ControlRunComplete
	ControlRunError
)

type ControlRunStatusProvider

type ControlRunStatusProvider interface {
	GetControlId() string
	GetRunStatus() ControlRunStatus
	GetStatusSummary() *StatusSummary
}

ControlRunStatusProvider is an interface used to allow us to pass a control as the payload of ControlComplete and ControlError events -

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) OnComplete

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

func (*ControlStatusHooks) OnControlComplete

func (*ControlStatusHooks) OnControlError

func (*ControlStatusHooks) OnControlStart

func (*ControlStatusHooks) OnStart

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

type NullControlHook

type NullControlHook struct{}

func (*NullControlHook) OnComplete

func (*NullControlHook) OnControlComplete

func (*NullControlHook) OnControlError

func (*NullControlHook) OnControlStart

func (*NullControlHook) OnStart

type StatusSummary

type StatusSummary struct {
	Alarm int `json:"alarm"`
	Ok    int `json:"ok"`
	Info  int `json:"info"`
	Skip  int `json:"skip"`
	Error int `json:"error"`
}

StatusSummary is a struct containing the counts of each possible control status

func (*StatusSummary) FailedCount

func (s *StatusSummary) FailedCount() int

func (*StatusSummary) Merge

func (s *StatusSummary) Merge(summary *StatusSummary)

func (*StatusSummary) PassedCount

func (s *StatusSummary) PassedCount() int

func (*StatusSummary) TotalCount

func (s *StatusSummary) TotalCount() int

Jump to

Keyboard shortcuts

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