framework

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code int

Code is the Status code/type which is returned from the framework.

const (
	// Success means that plugin ran correctly and found placement schedulable.
	// NOTE: A nil status is also considered as "Success".
	Success Code = iota
	// Warning means that plugin ran correctly and found placement schedulable, but with some failures to notice.
	Warning
	// Error is used for internal plugin errors etc.
	Error
	// Misconfigured is used for internal plugin configuration errors, unexpected input, etc.
	Misconfigured
)

These are predefined codes used in a Status.

type Status

type Status struct {
	// contains filtered or unexported fields
}

func NewStatus

func NewStatus(plugin string, code Code, reasons ...string) *Status

NewStatus makes a Status out of the given arguments and returns its pointer.

func (*Status) AppendReason

func (s *Status) AppendReason(reason string)

AppendReason appends given reason to the Status.

func (*Status) AsError

func (s *Status) AsError() error

AsError returns nil if the status is a success; otherwise returns an "error" object with a concatenated message on reasons of the Status.

func (*Status) Code

func (s *Status) Code() Code

Code returns code of the Status.

func (*Status) IsError

func (s *Status) IsError() bool

IsError returns true if and only if Code is "Error" or "Misconfigured".

func (*Status) IsSuccess

func (s *Status) IsSuccess() bool

IsSuccess returns true if and only if "Status" is nil or Code is "Success".

func (*Status) Message

func (s *Status) Message() string

Message returns a concatenated message on reasons of the Status.

func (*Status) Plugin

func (s *Status) Plugin() string

FailedPlugin returns the failed plugin name.

Jump to

Keyboard shortcuts

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