reconcilescheduler

package
v0.0.0-...-be4dc66 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CodeActivated is a reason code indicating that an element has been activated.
	CodeActivated = iota
	// CodeAlreadyActive is a reason code indicating that an element is active already.
	CodeAlreadyActive = iota

	// CodeChildActive is a reason code indicating that an element's child is currently active.
	CodeChildActive = iota

	// CodeParentPending is a reason code indicating that the element's parent has precedence.
	CodeParentPending = iota
	// CodeParentActive is a reason code indicating that the element's parent is currently active.
	CodeParentActive = iota
	// CodeParentNotReconciled is a reason code indicating that the element's parent has not yet been reconciled.
	CodeParentNotReconciled = iota
	// CodeParentUnknown is a reason code indicating that the element's parent is not (yet) known.
	CodeParentUnknown = iota

	// CodeOther is a reason code for unspecified reasons.
	CodeOther = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element interface {
	// GetID returns the ID of the element.
	GetID() ID
	// GetParent returns the ID of the element's parent.
	GetParentID() ID
}

Element describes the interface for getting the id an its parent.

type ID

type ID interface {
	// String returns the string representation of the id.
	String() string
}

ID describes the interface for an unique identifier of an object.

type Interface

type Interface interface {
	// TestAndActivate decides whether the given Element is allowed to be activated (with respected to whether it has
	// been modified and/or inhibitChildren).
	TestAndActivate(Element, bool, bool) (bool, *Reason)
	// Done marks the given ID as "done" (meaning that a reconciliation has been executed successful).
	Done(ID) bool
	// Delete deletes the given ID from the internal state.
	Delete(ID)

	// MarkStatic marks an identifier as "static" (meaning that it has no parent represented by another ID).
	MarkStatic(ID)
	// UnmarkStatic unmarks an identifer as "static".
	UnmarkStatic(ID)

	// Reset resets the internal state of the scheduler.
	Reset()
}

Interface describes the interface for interacting with the reconcile scheduler. It holds an internal state of elements and answers "may I schedule this element now" questions.

func New

func New(logger logrus.FieldLogger) Interface

New returns a new reconcile scheduler interface.

type Reason

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

Reason is a structure type that contains a reason code as well as a message. It is returned to users' requests in order to explain the made decision.

func NewReason

func NewReason(code int, msgFmt string, args ...interface{}) *Reason

NewReason creates a new reason structure with the given <code> and the message.

func (*Reason) Code

func (r *Reason) Code() int

Code returns the code of the Reason.

func (*Reason) Message

func (r *Reason) Message() string

Message returns the message of the Reason.

func (*Reason) String

func (r *Reason) String() string

String returns the string representation of Reason.

Jump to

Keyboard shortcuts

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