state

package
v0.0.0-...-bb2f907 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 6 Imported by: 12

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(ctx context.Context, ctxid string) (appcontext.AppContext, error)

GetAppContextFromStateInfo loads the appcontext present in the StateInfo input

func GetAppContextStatus

func GetAppContextStatus(ctx context.Context, ctxid string) (appcontext.AppContextStatus, error)

func GetContextIdForStatusContextId

func GetContextIdForStatusContextId(s StateInfo, ctxid string) (string, error)

GetContextIdForStatusContextId given a statusContextId (not checked), get the most recent ContextId - i.e. either end of the list or up to "Terminated" Assumed that 'ctxid' has already been identified as a status contextId.

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 GetStatusContextIdForContextId

func GetStatusContextIdForContextId(s StateInfo, ctxid string) (string, error)

GetStatusContextIdForContextId gets the status context id associated with the input context id. This will be the context id of the most recent "Instantiated" state. If the provided 'ctxid' is not found, then that is an error

func GetStatusContextIdFromStateInfo

func GetStatusContextIdFromStateInfo(s StateInfo) string

GetStatusContextIdFromStateInfo gets status AppContext

func UpdateAppContextStatusContextID

func UpdateAppContextStatusContextID(ctx context.Context, ctxid string, sctxid string) error

UpdateAppContextStatusContextID updates status context id in the AppContext

func UpdateAppContextStopFlag

func UpdateAppContextStopFlag(ctx context.Context, 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