flow

package
v0.0.0-...-044f632 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flow

type Flow struct {
	// contains filtered or unexported fields
}

Flow represents the progress of a single pipeline.Pipeline run. The flow consists of working specification.Scenario and specification.Thesis statuses. Each ApplyStep call moves the progress forward.

func FromStatuses

func FromStatuses(id, pipeID string, statuses ...*Status) *Flow

FromStatuses start a new flow from initialized statuses.

This method is similar to the other, but this method is intended solely for testing purposes.

func Fulfill

func Fulfill(id string, pipe *pipeline.Pipeline) *Flow

Fulfill starts a new flow from pipeline.Pipeline. The result of the function is a Flow, with which you can collect the steps during pipeline execution.

Each step contains information about the progress of the pipeline, including pipeline.Event. The states of statuses change under the action of events. The transition rules for the event are described in the State.Next method.

func (*Flow) ApplyStep

func (f *Flow) ApplyStep(step pipeline.Step) *Flow

ApplyStep is method for step by step collecting pipeline.Pipeline steps to move the progress of the pipeline by changing status states.

Flow state changes from call to call relying on the state transition rules in State.Next method.

func (*Flow) ID

func (f *Flow) ID() string

ID returns flow identifier.

func (*Flow) OverallState

func (f *Flow) OverallState() State

OverallState returns general Flow status selected from all specification.Scenario states according to State.Precedence.

func (*Flow) PipelineID

func (f *Flow) PipelineID() string

PipelineID returns associated with Flow pipeline identifier.

func (*Flow) Statuses

func (f *Flow) Statuses() []*Status

Statuses returns copy of scenario statuses.

type State

type State string
const (
	NoState     State = ""
	NotExecuted State = "not executed"
	Executing   State = "executing"
	Passed      State = "passed"
	Failed      State = "failed"
	Crashed     State = "crashed"
	Canceled    State = "canceled"
)

func (State) Next

func (s State) Next(with pipeline.Event) State

Next returns the next state depending on the received pipeline.Event.

State transition rules are defined for a finite automaton, then this function is a transition function for this automaton.

func (State) Precedence

func (s State) Precedence() int

Precedence indicates the priority in which the overall state will be selected from the entire scenario states.

The larger the number, the more likely it is that this state will be selected as an overall one.

func (State) String

func (s State) String() string

type Status

type Status struct {
	// contains filtered or unexported fields
}

Status represents progress of the specification.Scenario.

func NewStatus

func NewStatus(slug specification.Slug, state State, thesisStatuses ...*ThesisStatus) *Status

NewStatus creates a progress representation of specification.Scenario.

If the slug is not specification.ScenarioSlug, it panics with specification.ErrNotScenarioSlug.

func (*Status) Slug

func (s *Status) Slug() specification.Slug

Slug returns associated with Status scenario slug.

func (*Status) State

func (s *Status) State() State

State returns state of scenario.

func (*Status) ThesisStatuses

func (s *Status) ThesisStatuses() []*ThesisStatus

ThesisStatuses returns nested in Status thesis statuses.

type ThesisStatus

type ThesisStatus struct {
	// contains filtered or unexported fields
}

ThesisStatus represents progress of the specification.Thesis nested in Status.

func NewThesisStatus

func NewThesisStatus(slug string, state State, occurredErrs ...string) *ThesisStatus

NewThesisStatus creates a progress representation of specification.Thesis.

func (*ThesisStatus) OccurredErrs

func (s *ThesisStatus) OccurredErrs() []string

OccurredErrs returns errors that occurred during executing of theses.

func (*ThesisStatus) State

func (s *ThesisStatus) State() State

State returns state of thesis.

func (*ThesisStatus) ThesisSlug

func (s *ThesisStatus) ThesisSlug() string

ThesisSlug returns associated with ThesisStatus partial thesis slug.

Jump to

Keyboard shortcuts

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