state

package
v0.0.0-...-c85cc39 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################

Index

Constants

View Source
const COPYRIGHT string = `` /* 459-byte string literal not displayed */
View Source
const CustomExtensions = "custom"
View Source
const EmbeddedExtensions = "embedded"
View Source
const FirstState = "FirstState"
View Source
const LastState = "LastState"
View Source
const PhaseAtEachRun = "AtEachRun"
View Source
const StateFAILED = "FAILED"
View Source
const StatePREPROCESSING = "PREPROCESSING"
View Source
const StateREADY = "READY"
View Source
const StateRUNNING = "RUNNING"
View Source
const StateSKIP = "SKIP"
View Source
const StateSUCCEEDED = "SUCCEEDED"
View Source
const StatesFileErrorMessagePattern = "STATES_FILE_ERROR_MESSAGE:"

Variables

This section is empty.

Functions

func CopyExtensionToEmbeddedExtensionPath

func CopyExtensionToEmbeddedExtensionPath(extensionName string) error

CopyExtensionToEmbeddedExtensionPath copy the extension to the extension directory

func DeleteFormerEmbeddedExtensions

func DeleteFormerEmbeddedExtensions() error

DeleteFormerEmbeddedExtensions delete extensions which are not anymore defined in the extensionsEmbeddedFile

func GenerateTemplateFiles

func GenerateTemplateFiles(extensionName string, extensionPath string) error

func GenerateUIMetaDataTemplate

func GenerateUIMetaDataTemplate(extensionName string, uiMetadataName string, langs []string) ([]byte, error)

func GetExtensionsLogsPathCustom

func GetExtensionsLogsPathCustom() string

GetExtensionLogsPathCustom retrieves the custom extensions logs path

func GetExtensionsLogsPathEmbedded

func GetExtensionsLogsPathEmbedded() string

GetExtensionLogsPathEmbedded retrieves the embedded extensions logs path

func GetExtensionsPath

func GetExtensionsPath() string

GetExtensionPath retrieves the extension path

func GetExtensionsPathCustom

func GetExtensionsPathCustom() string

GetExtensionPathCustom retrieves the extension path for the custom extensions

func GetExtensionsPathEmbedded

func GetExtensionsPathEmbedded() string

GetExtensionPathEmbedded retrieves the extension path for embedded extensions

func GetIsRunningEndpoint

func GetIsRunningEndpoint(w http.ResponseWriter, req *http.Request)

Check if engine is running URL: /cr/v1/engine Method: GET

func GetMock

func GetMock() bool

Retrieve level

func GetMockEndpoint

func GetMockEndpoint(w http.ResponseWriter, req *http.Request)

func GetRegisteredExtensionPath

func GetRegisteredExtensionPath(extensionName string) (string, error)

GetRegisteredExtensionPath gets the extension path for a given registered extension

func GetRelativeExtensionPath

func GetRelativeExtensionPath(extensionName string) string

GetRelativeExtensionPath gets the relative extension path for a given registered extension

func GetRepoLocalPath

func GetRepoLocalPath() string

GetRepoLocalPath retrieves the location of the embedded extensions packages

func GetRootExtensionPath

func GetRootExtensionPath(rootDir string, extensionName string) string

GetRootExtensionPath gets the root extension path

func GetStateEndpoint

func GetStateEndpoint(w http.ResponseWriter, req *http.Request)

Retrieve the state record of a state URL: /cr/v1/state/<state> Method: GET

func GetStateLogEndpoint

func GetStateLogEndpoint(w http.ResponseWriter, req *http.Request)

Retrieve n lines of a log for a given state starting from line s URL: /cr/v1/log/state?first-line=s&lines=n Method: GET first-line default = 0 lines default = MaxInt64

func GetStatesEndpoint

func GetStatesEndpoint(w http.ResponseWriter, req *http.Request)

Retrieve the states URL: /cr/v1/states Method: GET

func GetUIMetaDataConfig

func GetUIMetaDataConfig(extensionName string, uiMetadataName string, langs []string) ([]byte, error)

func GetUIMetaDataConfigs

func GetUIMetaDataConfigs(extensionName string, namesOnly bool, langs []string) ([]byte, error)

func GetUIMetadataTranslated

func GetUIMetadataTranslated(extensionPath string, langs []string) (cfg *config.Config, messagesNotFound []string, err error)

func HandleEngine

func HandleEngine(w http.ResponseWriter, req *http.Request)

handle Engine rest api requests

func HandleExtension

func HandleExtension(w http.ResponseWriter, req *http.Request)

func HandleExtensions

func HandleExtensions(w http.ResponseWriter, req *http.Request)

func HandleState

func HandleState(w http.ResponseWriter, req *http.Request)

handle State rest api requests

func HandleStates

func HandleStates(w http.ResponseWriter, req *http.Request)

handle States rest api requests

func HandleTemplate

func HandleTemplate(w http.ResponseWriter, req *http.Request)

handle template rest api requests

func HandleUIMetadata

func HandleUIMetadata(w http.ResponseWriter, req *http.Request)

handle BMXCOnfig rest api requests

func HandleUIMetadatas

func HandleUIMetadatas(w http.ResponseWriter, req *http.Request)

handle BMXCOnfig rest api requests

func InitExtensions

func InitExtensions(embeddedExtensionsDescriptor string, embeddedExtensionsRepositoryPath string, extensionsPath string, extensionsLogsPath string)

Init initialise the extensionManager package. embeddedExtensionDescriptor the path to the file listing the embedded extension names. embeddedExtensionsRepositoryPath the directory path where the extensions are located. This path will be extended with "embeded" or "custom" depending of the type of extension. extensionsPath the directory path where the extension will be copied by the registration process. This path will be extended with "embeded" or "custom" depending of the type of extension. extensionsLogsPath the directory path where the logs will be save. This path is relative to extension deployment location which is <extensionPath>/<embedded|custom>/<extensionName>. This path will be extended with "embeded" or "custom" depending of the type of extension.

func IsCustomExtension

func IsCustomExtension(extensionName string) (bool, error)

IsCustomExtension Checks if extensionName is a custom extension

func IsCustomExtensionRegistered

func IsCustomExtensionRegistered(filename string) bool

IsCustomExtensionRegistered Check if an extension is register by browzing the extensions directory

func IsEmbeddedExtension

func IsEmbeddedExtension(extensionName string) (bool, error)

IsEmbeddedExtension Checks if extensionName is a Embedded extension

func IsEmbeddedExtensionRegistered

func IsEmbeddedExtensionRegistered(filename string) bool

IsEmbeddedxtensionRegistered Check if an extension is register by browzing the extensions directory

func IsExtensionRegistered

func IsExtensionRegistered(extensionName string) bool

IsExtensionRegistered Check if an extension is register by browzing the extensions directory

func PutDeleteStateStatesEndpoint

func PutDeleteStateStatesEndpoint(w http.ResponseWriter, req *http.Request)

PUT delete a state in a state file URL: /cr/v1/states?extension-name=<extension-name>&action=delete&pos=<int> Method: PUT

func PutInsertStateStatesEndpoint

func PutInsertStateStatesEndpoint(w http.ResponseWriter, req *http.Request)

PUT insert a state in a state file URL: /cr/v1/states?extension-name=<extension-name>&action=insert&pos=<int>&before=<bool> Method: PUT

func PutResetEngineEndpoint

func PutResetEngineEndpoint(w http.ResponseWriter, req *http.Request)

Reset the engine URL: /cr/v1/engine?action=<action> Method: PUT action: 'reset'

func PutResetEngineExecutionInfoEndpoint

func PutResetEngineExecutionInfoEndpoint(w http.ResponseWriter, req *http.Request)

Reset the engine URL: /cr/v1/engine?action=<action> Method: PUT action: 'reset-execution-info'

func PutSetStatusesStatesEndpoint

func PutSetStatusesStatesEndpoint(w http.ResponseWriter, req *http.Request)

PUT set a range of states to a specific status URL: /cr/v1/states?extension-name=<extension-name>&action=set-statuses&status=<status>&from-state-name=<state_from>&from-inclusive=<bool>&to-state-name=<state_to>&to-inclusive=<bool> Method: PUT

func PutStartEngineEndpoint

func PutStartEngineEndpoint(w http.ResponseWriter, req *http.Request)

Start the engine URL: /cr/v1/egine?action=<action>&from_state=<from_state>&to_state=<to_state> Method: PUT action: 'start' first-state default = first state to-state default = last staten

func PutStateEndpoint

func PutStateEndpoint(w http.ResponseWriter, req *http.Request)

Set the status for a state URL: /cr/v1/state/<state>?status=newStatus Method: PUT status: newStatus

func PutStatesEndpoint

func PutStatesEndpoint(w http.ResponseWriter, req *http.Request)

PUT the states URL: /cr/v1/states?overwrite=<true|false> Method: GET

func RegisterEmbededExtensions

func RegisterEmbededExtensions(force bool, runningToFailed bool) error

registerEmbededExtension register all embeded extensions force: if true and already registered the extension is overwritten runningToFailed: if true and the extension is running then the running state will be set to FAILED

func RegisterExtension

func RegisterExtension(extensionName, zipPath string, force bool, runningToFailed bool) error

RegisterExtension register an extension force: if true and already registered the extension is overwritten runningToFailed: if true and the extension is running then the running state will be set to FAILED

func SetEmbeddedExtensionsRepositoryPath

func SetEmbeddedExtensionsRepositoryPath(_embeddedExtensionsRepositoryPath string) error

SetEmbeddedExtensionsRepositoryPath set the path where the embedded extension are stored

func SetExtensionsEmbeddedFile

func SetExtensionsEmbeddedFile(_extensionsEmbeddedFile string)

SetExtensionEmbeddedFile sets the embedded extension path file descriptor

func SetExtensionsLogsPath

func SetExtensionsLogsPath(_extensionsLogsPath string)

SetExtensionLogsPath set the path where the extensions logs are kept

func SetExtensionsPath

func SetExtensionsPath(_extensionsPath string)

SetExtensionPath set the path where the extensions must be deployed

func SetMock

func SetMock(mock bool)

func SetMockEndpoint

func SetMockEndpoint(w http.ResponseWriter, req *http.Request)

func UnregisterExtension

func UnregisterExtension(extensionName string) error

UnregisterExtension delete and extension, deletion of Embedded extension is not permitted.

func Unzip

func Unzip(src, dest, extensionName string) error

Unzip unzip an extension zip file to a destination directory

Types

type CallState

type CallState struct {
	StatesToRerun  []string `yaml:"states_to_rerun" json:"states_to_rerun"`
	PreviousStates []string `yaml:"previous_states" json:"previous_states"`
	NextStates     []string `yaml:"next_states" json:"next_states"`
}

type Extension

type Extension struct {
	Type                string    `yaml:"type" json:"type"`
	Version             string    `yaml:"version" json:"version"`
	CallState           CallState `yaml:"call_state" json:"call_state"`
	ValidationConfigURL string    `yaml:"validation_config_url" json:"validation_config_url"`
	GenerateConfigURL   string    `yaml:"generate_config_url" json:"generate_config_url"`
	ExtensionPath       string    `yaml:"-" json:"-"`
	//PersistedPaths The path listed in that array will be not erased between upgrades.
	//The states-file path is always added to that array.
	//The path is a pattern relative to the extension home directory.
	//The pattern syntax is described at https://golang.org/src/path/filepath/match.go?s=1226:1284#L34
	PersistedPaths []string `yaml:"persisted_paths" json:"persisted_paths"`
}

Extension structure

func ReadRegisteredExtension

func ReadRegisteredExtension(extensionName string) (*Extension, error)

type Extensions

type Extensions struct {
	Extensions map[string]Extension `yaml:"extensions" json:"extensions"`
}

Extensions is a map of Extension

func ListEmbeddedExtensions

func ListEmbeddedExtensions() (*Extensions, error)

ListEmbeddedExtensions returns extensions by reading the resourceManager extension file.

func ListEmbeddedRegisteredExtensions

func ListEmbeddedRegisteredExtensions() (*Extensions, error)

ListEmbeddedRegisteredExtensions lists the registered embedded exxtensions

func ListExtensions

func ListExtensions(filter string, catalog bool) (*Extensions, error)

ListExtensions lists all extensions

func ListRegisteredCustomExtensions

func ListRegisteredCustomExtensions() (*Extensions, error)

ListCustomExtensions returns extensions by reading the custom extension directory Custom extensions get be listed only if registered.

type Mock

type Mock struct {
	Mock bool `yaml:"mock" json:"mock"`
}

type State

type State struct {
	//Name name of the state
	Name string `yaml:"name" json:"name"`
	//Phase If the value is set to "AtEachRun" then the state will be executed each time the commands-runner is launched and this independently of its status except if status is "SKIP"
	Phase string `yaml:"phase" json:"phase"`
	//Label A more human readable name for the state (default: name)
	Label string `yaml:"label" json:"label"`
	//LogPath Location of the file that will collect the stdin/stderr. (default: extensionPath+extenstionName.log)
	LogPath string `yaml:"log_path" json:"log_path"`
	//Status The current state status (default: READY)
	Status string `yaml:"status" json:"status"`
	//StartTime If not empty, it contains the last time when the state was executed
	StartTime string `yaml:"start_time" json:"start_time"`
	//EndTime if not empty, it contains the last end execution time of the state
	EndTime string `yaml:"end_time" json:"end_time"`
	//Reason if not empty, it contains the reason of execution failure
	Reason string `yaml:"reason" json:"reason"`
	//Script The command or script to execute. The path must be an absolute path
	Script string `yaml:"script" json:"script"`
	//ScriptTimeout The maximum duration of the state execution, after that duration a timeout error will be produced.
	ScriptTimeout int `yaml:"script_timeout" json:"script_timeout"`
	//Protected If true the commands-runner end-user will be not be able to delete the state.
	Protected bool `yaml:"protected" json:"protected"`
	//Deleted If true the corresponding state will be deleted when merging with an existing states file.
	Deleted bool `yaml:"deleted" json:"deleted"`
	//PrerequisiteStates  if the current states is READY/FAILED then those listed will be set to READY too.
	//Each listed state must be before the current state.
	PrerequisiteStates []string `yaml:"prerequisite_states" json:"prerequisite_states"`
	//StatesToRerun if the current state is READY/FAILED then those listed will be set to READY too.
	//Each listed state must be after the current state.
	StatesToRerun []string `yaml:"states_to_rerun" json:"states_to_rerun"`
	//RerunOnRunOfStates if one state of this list is READY/FAILED then the current state will be set to READY.
	//Each listed state must be before the current state.
	RerunOnRunOfStates []string `yaml:"rerun_on_run_of_states" json:"rerun_on_run_of_states"`
	//CalculatedStatesToRerun (not-persisted/used internally) Calculated list of states to rerun
	CalculatedStatesToRerun []string `yaml:"-" json:"-"`
	//PreviousStates List of previous states, this is not taken into account for the topology sort.
	PreviousStates []string `yaml:"previous_states" json:"previous_states"`
	//NextStates List of next states, this determines the order in which the states will get executed. A topological sort is used to determine the order.
	//If this attribute is not defined in any state of the states file then the NextStates for each state will be set by default to the next state in the states file.
	NextStates []string `yaml:"next_states" json:"next_states"`
	//ExecutedByExtensionName is set at execution time with the value of sm.ExecutedByExtensionName.
	ExecutedByExtensionName string `yaml:"executed_by_extension_name" json:"executed_by_extension_name"`
	//The execution sequence id for that specific launch
	ExecutionID int `yaml:"execution_id" json:"execution_id"`
	//This is true if the state will run based on status, PrerequisiteStates, RerunOnRunOfStates and StatesToRerun
	NextRun bool `yaml:"next_run" json:"next_run"`
	//This is true when the state is a extension
	IsExtension bool `yaml:"is_extension" json:"is_extension"`
}

type States

type States struct {
	StateArray    []State `yaml:"states" json:"states"`
	ExtensionName string  `yaml:"extension_name" json:"extension_name"`
	//Parent extension name, this is set when the extension is inserted into another extension.
	//Empty if not inserted.
	ParentExtensionName string `yaml:"parent_extension_name" json:"parent_extension_name"`
	//ExecutedByExtensionName is set at execution time and contains the name of the extension which launch the current extension.
	//If extension A contains extension B contains extension C then it contains extension A name.
	//It is NOT the direct parent extension name.
	ExecutedByExtensionName string `yaml:"executed_by_extension_name" json:"executed_by_extension_name"`
	//The execution sequence id for that specific launch
	ExecutionID int `yaml:"execution_id" json:"execution_id"`
	//StartTime If not empty, it contains the last time when the state was executed
	StartTime string `yaml:"start_time" json:"start_time"`
	//EndTime if not empty, it contains the last end execution time of the state
	EndTime string `yaml:"end_time" json:"end_time"`
	//Status states status
	Status     string `yaml:"status" json:"status"`
	StatesPath string `yaml:"-" json:"-"`
	// contains filtered or unexported fields
}

func GetStatesManager

func GetStatesManager(extensionName string) (*States, error)

Search for a stateManager and if not found create it

func (*States) CalculateStatesToRun

func (sm *States) CalculateStatesToRun(fromState string, toState string) (map[string]string, error)

func (*States) DeleteState

func (sm *States) DeleteState(pos int, stateName string) error

DeleteState Delete a state at a given position or with a given name Array start in Go at 0 but here the pos 1 is the elem 0

func (*States) Execute

func (sm *States) Execute(fromState string, toState string, callerState *State, callerOutFile *os.File) error

Execute states from state 'fromState' to state 'toState'

func (*States) GetLog

func (sm *States) GetLog(state string, position int64, length int64, bychar bool) ([]byte, error)

GetLog Retrieve log of a given state. state: Look at the log of a given state. position: start at position (byte) in the log (default:0) len: number of byte to retrieve. Return a []byte containing the requested log or an error.

func (*States) GetLogs

func (sm *States) GetLogs(position int64, length int64, bychar bool) (string, error)

GetLogs Get logs from a given position, a given length. The length is the number of characters to return if bychar is true otherwize is the number of lines.

func (*States) GetState

func (sm *States) GetState(state string, langs []string) (*State, error)

GetState return a state providing its name

func (*States) GetStates

func (sm *States) GetStates(status string, extensionsOnly bool, recursive bool, langs []string) (*States, error)

GetStates returns the list of states with a given status. if the status is an empty string then it returns all states.

func (*States) InsertState

func (sm *States) InsertState(state State, referencePosition int, referenceStateName string, before bool, overwrite bool) error

InsertState Insert state at a given state position, before or after a given state. If the referencePosition is not 0, then that position will be used as reference for insertion If the referencePosition is equal 0 and the referenceStateName is provided, the position of the referenceStateName will be used as reference for insertion If the referencePosition is 0 and the referenceStateName is not provided then the state will be inserted taking into account the PreviousStates and NextStates of the inserted state. If the state is already present, then it is updated if overwrite is true Array start in Go at 0 but here the pos 1 is the elem 0

func (*States) InsertStateFromExtensionName

func (sm *States) InsertStateFromExtensionName(extensionName string, pos int, stateName string, before bool, overwrite bool) error

func (*States) InsertStateFromString

func (sm *States) InsertStateFromString(stateDef string, pos int, stateName string, before bool, overwrite bool) error

InsertStateFromString Insert state at a given position, before or after a given state. The state Def is provided as a string If the position is 0 and the stateName is not provided then the state will be inserted taking into account the PreviousStates and NextStates of the inserted state. Array start in Go at 0 but here the pos 1 is the elem 0

func (*States) IsRunning

func (sm *States) IsRunning() (bool, error)

IsRunning Check if states is running in the persisted states

func (*States) NextStatesIndexOf

func (sm *States) NextStatesIndexOf(currentState State, stateName string) int

NextStatesIndexOf return the index of a stateName in the NextStates

func (*States) ResetEngine

func (sm *States) ResetEngine() error

ResetEngine Reset states, all non-skip state will be set to READY recursively No RUNNING state must be found.

func (*States) ResetEngineExecutionInfo

func (sm *States) ResetEngineExecutionInfo() error

ResetEngine Reset execution Info. This is not recursive yet. No RUNNING state must be found.

func (*States) SetState

func (sm *States) SetState(state string, status string, reason string, script string, scriptTimout int, recursivelly bool) error

SetState Set a state status

func (*States) SetStates

func (sm *States) SetStates(states States, overwrite bool) error

SetStates Set the current states with a new states. If overwrite is false, then the 2 states will be merged. States marked deleted in the new states will be removed for the current states.

func (*States) SetStatesStatuses

func (sm *States) SetStatesStatuses(status string, fromStateName string, fromIncluded bool, toStateName string, toIncluded bool) error

SetStatesStatuses Sets the status of states within a range.

func (*States) Start

func (sm *States) Start() error

Start states from beginning to end

type TraversePropertiesCallBack

type TraversePropertiesCallBack func(property map[string]interface{}, first bool, mandatory bool, parentProperty map[string]interface{}, path string, input interface{}) (err error)

Jump to

Keyboard shortcuts

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