controlstatus

package
v0.21.2-rc.3 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 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 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 ControlRunStatusProvider

type ControlRunStatusProvider interface {
	GetControlId() string
	GetRunStatus() dashboardtypes.RunStatus
	GetStatusSummary() *StatusSummary
}

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

type NullControlHook

type NullControlHook struct{}

func (*NullControlHook) OnComplete

func (*NullControlHook) OnControlComplete

func (*NullControlHook) OnControlError

func (*NullControlHook) OnControlStart

func (*NullControlHook) OnStart

type SnapshotControlHooks added in v0.17.0

type SnapshotControlHooks struct {
	Enabled bool
}

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

func NewSnapshotControlHooks added in v0.17.0

func NewSnapshotControlHooks() *SnapshotControlHooks

func (*SnapshotControlHooks) OnComplete added in v0.17.0

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

func (*SnapshotControlHooks) OnControlComplete added in v0.17.0

func (c *SnapshotControlHooks) OnControlComplete(ctx context.Context, _ ControlRunStatusProvider, progress *ControlProgress)

func (*SnapshotControlHooks) OnControlError added in v0.17.0

func (*SnapshotControlHooks) OnControlStart added in v0.17.0

func (*SnapshotControlHooks) OnStart added in v0.17.0

type StatusControlHooks added in v0.17.0

type StatusControlHooks struct {
	Enabled bool
}

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

func NewStatusControlHooks added in v0.17.0

func NewStatusControlHooks() *StatusControlHooks

func (*StatusControlHooks) OnComplete added in v0.17.0

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

func (*StatusControlHooks) OnControlComplete added in v0.17.0

func (*StatusControlHooks) OnControlError added in v0.17.0

func (*StatusControlHooks) OnControlStart added in v0.17.0

func (*StatusControlHooks) OnStart added in v0.17.0

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

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