state

package
v0.0.0-...-7c77b90 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StateEnum = &states{
	Undefined:          "Undefined",
	Created:            "Created",
	Approved:           "Approved",
	Applied:            "Applied",
	Instantiated:       "Instantiated",
	Terminated:         "Terminated",
	InstantiateStopped: "InstantiateStopped",
	TerminateStopped:   "TerminateStopped",
	Updated:            "Updated",
}

Functions

func GetAppContextFromId

func GetAppContextFromId(ctxid string) (appcontext.AppContext, error)

GetAppContextFromStateInfo loads the appcontext present in the StateInfo input

func GetAppContextStatus

func GetAppContextStatus(ctxid string) (appcontext.AppContextStatus, error)

func GetContextIdsFromStateInfo

func GetContextIdsFromStateInfo(s StateInfo) []string

GetContextIdsFromStatInfo return a list of the unique AppContext Ids in the StateInfo

func GetLastContextIdFromStateInfo

func GetLastContextIdFromStateInfo(s StateInfo) string

GetLastContextFromStatInfo gets the last (most recent) context id from StateInfo

func GetLatestRevisionFromStateInfo

func GetLatestRevisionFromStateInfo(s StateInfo) (int64, error)

GetLatestRevisionFromStateInfo returns the latest revision from StateInfo

func GetMatchingContextIDforRevision

func GetMatchingContextIDforRevision(s StateInfo, r int64) (string, error)

GetMatchingContextIDforRevision returns the matching contextID for a given revision and stateInfo

func GetStatusContextIdFromStateInfo

func GetStatusContextIdFromStateInfo(s StateInfo) string

GetStatusContextIdFromStateInfo gets status AppContext

func UpdateAppContextStatusContextID

func UpdateAppContextStatusContextID(ctxid string, sctxid string) error

UpdateAppContextStatusContextID updates status context id in the AppContext

func UpdateAppContextStopFlag

func UpdateAppContextStopFlag(ctxid string, sf bool) error

Types

type ActionEntry

type ActionEntry struct {
	State     StateValue `json:"state"`
	ContextId string     `json:"instance"`
	TimeStamp time.Time  `json:"time"`
	Revision  int64      `json:"revision"`
}

ActionEntry is used to keep track of the time an action (e.g. Created, Instantiate, Terminate) was invoked For actions where an AppContext is relevent, the ContextId field will be non-zero length

type StateInfo

type StateInfo struct {
	// Same Status AppContext between instantiation and termination for a DIG
	StatusContextId string        `json:"statusctxid"`
	Actions         []ActionEntry `json:"actions"`
}

StateInfo struct is used to maintain the values for state, contextid, (and other) information about resources which can be instantiated via rsync. The last Actions entry holds the current state of the container object.

type StateValue

type StateValue = string

func GetCurrentStateFromStateInfo

func GetCurrentStateFromStateInfo(s StateInfo) (StateValue, error)

GetCurrentStateFromStatInfo gets the last (current) state from StateInfo

Jump to

Keyboard shortcuts

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