Documentation ¶
Index ¶
- Constants
- type CDLDependency
- type CDLFunc
- func (cdl *CDLFunc) BlockType(stateid string, line string) (int, error)
- func (cdl *CDLFunc) Condition(stateid string, line string) bool
- func (cdl *CDLFunc) GetDependency(stateid, line string) (*CDLDependency, error)
- func (cdl *CDLFunc) GetInclusion(stateid string, line string) (*CDLInclusion, error)
- func (cdl *CDLFunc) ImportSource(id string, srcpath string)
- func (cdl *CDLFunc) Loop(stateid string, line string) (*CDLLoop, error)
- func (cdl *CDLFunc) ToCDLKey(stateid string, line string) string
- type CDLInclusion
- type CDLLoop
- type NstCompiler
- func (nstc *NstCompiler) Compile() error
- func (nstc *NstCompiler) Cycle() string
- func (nstc *NstCompiler) Dump()
- func (nstc *NstCompiler) LoadFile(nstpath string) error
- func (nstc *NstCompiler) SetDebug(state bool) *NstCompiler
- func (nstc *NstCompiler) SquashState(id string)
- func (nstc *NstCompiler) Tree() *OTree
- type OTree
- func (tree *OTree) Delete(key interface{}) *OTree
- func (tree *OTree) Exists(key interface{}) bool
- func (tree *OTree) Flush() *OTree
- func (tree *OTree) Get(key interface{}, bydefault interface{}) interface{}
- func (tree *OTree) GetBranch(key interface{}) *OTree
- func (tree *OTree) GetList(key interface{}) []interface{}
- func (tree *OTree) GetString(key interface{}) string
- func (tree *OTree) Items() [][]interface{}
- func (tree *OTree) Keys() []interface{}
- func (tree *OTree) LoadMapSlice(data yaml.MapSlice) *OTree
- func (tree *OTree) Serialise() map[string]interface{}
- func (tree *OTree) Set(key interface{}, value interface{}) *OTree
- func (tree *OTree) ToYAML() string
- type RefList
- func (rl *RefList) FindRefs(state *OTree)
- func (rl *RefList) Flush() *RefList
- func (rl *RefList) GetIncluded() []string
- func (rl *RefList) GetMandatoryUnresolved() []string
- func (rl *RefList) GetReferencedJobs() []string
- func (rl *RefList) GetRequiredJobs() []string
- func (rl *RefList) MarkStateRequested(id string) string
- func (rl *RefList) MarkStateResolved(id string) *RefList
- type StarTuple
- type StarType
- type StarlarkProcess
Constants ¶
const ( CDL_T_INCLUSION = iota CDL_T_DEPENDENCY CDL_T_LOOP CDL_T_OPTIONAL_INCLUSION )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CDLDependency ¶
type CDLFunc ¶
type CDLFunc struct {
// contains filtered or unexported fields
}
func NewCDLFunc ¶
func NewCDLFunc() *CDLFunc
func (*CDLFunc) Condition ¶
Condition evaluates all possible conditions.
Although Wiz CDL supports multiple conditions in one line, yet they are not encouraged and are evaluated with "OR" statement (any).
Example:
something ?one ?two
If "one" or "two" results to "true", then "something" will happen. For complex conditions they needs to be combined in Skylark function and expressed in Wiz CDL as a single condition.
Example:
something ?onetwo
def onetwo():
return one() and two()
func (*CDLFunc) GetDependency ¶
func (cdl *CDLFunc) GetDependency(stateid, line string) (*CDLDependency, error)
Dependency can include specific list of blocks from a state in the order they are defined. It does not allow to include the entire state with all the blocks:
<BLOCK-ID> &<STATE-ID>/<BLOCK-ID>:[BLOCK-ID]:...
Blocks are delimited with colon ":" symbol. For example, to add only one block from some state:
do-something &my-state/my-block
To add few blocks from that state:
do-something &my-state/my-block:my-other-block
func (*CDLFunc) GetInclusion ¶
func (cdl *CDLFunc) GetInclusion(stateid string, line string) (*CDLInclusion, error)
Inclusion can have the entire state included or only specific blocks from it. The format is the following:
~<STATE-ID>/[BLOCK-A]:[BLOCK-B]:...
Blocks are delimited with colon ":" symbol. For example, to add the entire state:
~my-state
To add only one block from that state:
~my-state/my-block
To add few blocks from that state:
~my-state/my-block:my-other-block
All jobs from that block will be included.
func (*CDLFunc) ImportSource ¶
ImportSource of Starlark script and evaluate it into a running thread. StarlarkProcess has extra-check for the source contains only functions.
func (*CDLFunc) Loop ¶
Loop returns an array of key/value maps as keyword arguments and applies given function or module on each.
Example:
my-job: - my_module []my_function
The "my_function" is expected to return an array with keywords map inside, e.g.:
def my_function(): return [ { "name": "value", "other": "value", }, { "name": "something", "other": "something-else". } ]
In this case the example above will be compiled to the following:
my-job: - my_module: name: value other: value - my_module: name: something other: something-else
type CDLInclusion ¶
type NstCompiler ¶
type NstCompiler struct {
// contains filtered or unexported fields
}
func NewNstCompiler ¶
func NewNstCompiler() *NstCompiler
func (*NstCompiler) Cycle ¶
func (nstc *NstCompiler) Cycle() string
Cycle compiles current state and returns a next state Id to be found and loaded, if any. If returns an empty string, then no more cycles are found and Tree is ready.
func (*NstCompiler) Dump ¶
func (nstc *NstCompiler) Dump()
func (*NstCompiler) LoadFile ¶
func (nstc *NstCompiler) LoadFile(nstpath string) error
LoadFile loads a nanostate from the YAML file
func (*NstCompiler) SetDebug ¶
func (nstc *NstCompiler) SetDebug(state bool) *NstCompiler
SetDebug state
func (*NstCompiler) SquashState ¶
func (nstc *NstCompiler) SquashState(id string)
type OTree ¶
type OTree struct {
// contains filtered or unexported fields
}
func (*OTree) Get ¶
func (tree *OTree) Get(key interface{}, bydefault interface{}) interface{}
Get key with the default
func (*OTree) GetBranch ¶
GetBranch of the current tree. If branch is not an OTree object or not found, nil is returned.
func (*OTree) GetList ¶
func (tree *OTree) GetList(key interface{}) []interface{}
GetList returns an object as an array of the interfaces. If an object is not a slice, nil is returned.
func (*OTree) GetString ¶
GetString returns a string, blindly assuming it is one. XXX: better implementation needed. :)
func (*OTree) LoadMapSlice ¶
LoadMapSlice loads a yaml.MapSlice object that keeps the ordering
type RefList ¶
type RefList struct {
// contains filtered or unexported fields
}
func NewRefList ¶
func NewRefList() *RefList
func (*RefList) GetIncluded ¶
func (*RefList) GetMandatoryUnresolved ¶
func (*RefList) GetReferencedJobs ¶
func (*RefList) GetRequiredJobs ¶
func (*RefList) MarkStateRequested ¶
MarkVisited marks a reference as "seen" and "requested". If it gets marked again, it means the request wasn't completed, so we hit a infinite cycle, which needs to be broken out.
func (*RefList) MarkStateResolved ¶
MarkResolved marks a reference as "resolved" and removes from the stack
type StarTuple ¶
type StarTuple struct {
// contains filtered or unexported fields
}
func NewStarTuple ¶
func NewStarTuple() *StarTuple
type StarType ¶
type StarType struct {
// contains filtered or unexported fields
}
//////
type StarlarkProcess ¶
type StarlarkProcess struct {
// contains filtered or unexported fields
}
func NewStarlarkProcess ¶
func NewStarlarkProcess() *StarlarkProcess
func (*StarlarkProcess) LoadFile ¶
func (sp *StarlarkProcess) LoadFile(src string) error