Documentation ¶
Index ¶
- type CompletedError
- type Graph
- type Mission
- func (m *Mission) Bytes() []byte
- func (m *Mission) CheckComplete()
- func (m *Mission) ExcludeStage(stageName string) (Response, error)
- func (m *Mission) FailStage(stageName string) (Response, error)
- func (m *Mission) FinishStage(stageName string, ignoreDependencies bool) (Response, error)
- func (m *Mission) GetStage(stageName string) (*Stage, error)
- func (m *Mission) Next() []string
- func (m *Mission) Print()
- func (m *Mission) Report() string
- func (m *Mission) SkipStage(stageName string) (Response, error)
- func (m *Mission) StartStage(stageName string, ignoreDependencies bool) (Response, error)
- func (m *Mission) Validate() error
- type PlanValidationError
- type Response
- type Stage
- type StageChangeError
- type StageNotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompletedError ¶
type CompletedError struct{}
func (*CompletedError) Error ¶
func (e *CompletedError) Error() string
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph object represents the mission DAG in terms of links between stages
func NewGraph ¶
NewGraph builds graph object. note: This runs before we check that all stages are defined, so it just skips stages that can't be found.
func (*Graph) AddLink ¶
AddLink is used to create the graph object from each link seen in the graph.
func (*Graph) CheckForCycle ¶
CheckForCycle recursively crawls the graph and returns true if starting stage is seen again.
func (*Graph) CheckForIncontiguity ¶
CheckForIncontiguity returns the first stage found that can't be reached from the starting stage. If the graph is contiguous then it will return nil.
type Mission ¶
type Mission struct { Id string `json:"i" name:"id"` Name string `json:"n" name:"name"` // the plan name, note: not needed in a mission Services []string `json:"a" name:"services"` Stages []*Stage `json:"s" name:"stages"` Params map[string]interface{} `json:"p" name:"params"` Start time.Time `json:"t" name:"start"` End time.Time `json:"e" name:"end"` // contains filtered or unexported fields }
func New ¶
New creates a new mission from the minimum amount of information. Should only be used when converting plans to missions for validation.
func NewFromJSON ¶
NewFromJSON creates missions objects from their database representation in JSON. Runs every time the mission is modified.
func (*Mission) Bytes ¶
Bytes converts mission to it's json representation as bytes. Used for outputting missions.
func (*Mission) CheckComplete ¶
func (m *Mission) CheckComplete()
CheckComplete marks the mission as complete if all stages have been finished, excluded, or skipped. Should run every time a stage is finished, excluded or skipped.
func (*Mission) ExcludeStage ¶
ExcludeStage changes a stage's state to excluded using the following logic: - does stage exist? - state can't be started, finished, failed or skipped - are all upstream dependencies ready? - all downstream dependencies must be excluded too
func (*Mission) FailStage ¶
FailStage changes a stage's state to failed using the following logic: - does stage exist? - state can't be ready, failed, excluded, skipped or failed, just started
func (*Mission) FinishStage ¶
FinishStage changes a stage's state to finished using the following logic: - does stage exist? - is stage ready or failed (all other states are not allowed)? - are all upstream dependencies finished or skipped?
func (*Mission) Print ¶
func (m *Mission) Print()
Print prints all the information about the mission.
func (*Mission) SkipStage ¶
SkipStage changes a stage's state to skip using the following logic: - does stage exist? - state can't be started, excluded or already skipped? - are all upstream dependencies finished or skipped?
func (*Mission) StartStage ¶
StartStage changes a stage's state to started using the following logic: - does stage exist? - is stage ready or failed? (all other states are not allowed) - are all upstream dependencies finished or skipped?
type PlanValidationError ¶
type PlanValidationError struct {
Detail string
}
func (*PlanValidationError) Error ¶
func (e *PlanValidationError) Error() string
type Response ¶
type Response struct { Success bool `json:"success"` Next []string `json:"next"` IsComplete bool `json:"complete"` }
Response given when the user requests to change the state of a stage, e.g. start, finish, ignore, skip.
type Stage ¶
type Stage struct { Name string `json:"n" name:"name"` Service string `json:"a" name:"service"` Upstream []string `json:"u" name:"upstream"` Downstream []string `json:"d" name:"downstream"` Params map[string]interface{} `json:"p" name:"params"` State state `json:"s" name:"state"` Start time.Time `json:"t" name:"start"` End time.Time `json:"e" name:"end"` }
func (*Stage) PrintDuration ¶
type StageChangeError ¶
type StageChangeError struct {
Detail string
}
func (*StageChangeError) Error ¶
func (e *StageChangeError) Error() string
type StageNotFoundError ¶
type StageNotFoundError struct {
StageName string
}
func (*StageNotFoundError) Error ¶
func (e *StageNotFoundError) Error() string