op

package
v0.4.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StatusCounts

func StatusCounts(ops map[string]Op) (map[Status]int, error)

StatusCounts takes a slice of op references and returns a map containing sums of each Status

Types

type Op

type Op struct {
	Identifier string                 `json:"-"`
	Result     interface{}            `json:"result"`
	ErrString  string                 `json:"error"` // this simplifies json marshaling
	Error      error                  `json:"-"`
	Status     Status                 `json:"status"`
	Params     map[string]interface{} `json:"params,omitempty"`
}

Op seeks information via its Runner then stores the results.

func New

func New(id string, result interface{}, status Status, err error, params map[string]interface{}) Op

New takes a runner its results, serializing it into an immutable Op struct.

type Status

type Status string

Status describes the result of an operation.

const (
	// Success means all systems green
	Success Status = "success"

	// Fail means that we detected a known error and can conclusively say that the runner did not complete.
	Fail Status = "fail"

	// Unknown means that we detected an error and the result is indeterminate (e.g. some side effect like disk or
	//   network may or may not have completed) or we don't recognize the error. If we don't recognize the error that's
	//   a signal to improve the error handling to account for it.
	Unknown Status = "unknown"

	// Skip means that this Op was intentionally not run
	Skip Status = "skip"
)

Jump to

Keyboard shortcuts

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