state

package
v0.63.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdStartEngine  = "engine:start"
	CmdFinishEngine = "engine:finish"
	CmdStartTask    = "task:start"
	CmdFinishTask   = "task:finish"
)
View Source
const (

	// EngineStateInProgress pipeline in execution progress
	EngineStateInProgress string = "in-progress"
	// EngineStateFinished pipeline is finished execution
	EngineStateFinished string = "finished"

	// EngineStatusSuccess marks the engine as finished successfully
	EngineStatusSuccess = "Success"

	// EngineStatusFailed marks the engine as finished with error
	EngineStatusFailed = "failed"

	// TaskStateElected task is in progress
	TaskStateElected string = "elected"

	// TaskStateInProgress task is in progress
	TaskStateInProgress string = EngineStateInProgress

	// TaskStateFinished task is finished
	TaskStateFinished string = EngineStateFinished

	// TaskStatusSuccess set on the task status in case task was finished successfully
	TaskStatusSuccess = "Success"

	// TaskStatusFailed set on the task status in case task was finished with error
	TaskStatusFailed = "failed"
)
View Source
const (
	EventEngineStarted  = "engine.started"
	EventEngineFinished = "engine.finished"
	EventTaskStarted    = "task.started"
	EventTaskFinished   = "task.finished"
	EventTaskElected    = "task.elected"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddRealtedTaskToEventReuqest added in v0.39.0

type AddRealtedTaskToEventReuqest struct {
	EventID string
	Task    []string
}

type ElectTasksRequest added in v0.39.0

type ElectTasksRequest struct {
	Tasks []task.Task
}

type Options

type Options struct {
	Name string
	// EventChan to write new event to the channel once a chance was applied
	EventChan chan *event.Event
	// CommandsChan to receive commands to create new change channel
	CommandsChan chan string
	// StateUpdateRequest to receive updated on the state in realtime
	StateUpdateRequest chan StateUpdateRequest
	Logger             logger.Logger
	WG                 *sync.WaitGroup
}

Options to pass to the state

type ServiceState

type ServiceState struct {
}

ServiceState is a representation of a state of one service

type State

type State interface {
	Copy() (State, error)
	Tasks() map[string]TaskState
	Events() []event.Event
	Services() []ServiceState
	StateBytes() ([]byte, error)
	EventBytes() ([]byte, error)
	StartProcess()
}

State holds all the data of the pipeline execution flow

func New

func New(opt *Options) State

New builds nnew State from options

type StateUpdateRequest added in v0.39.0

type StateUpdateRequest struct {
	Metadata                     StateUpdateRequestMetadata
	ElectTasksRequest            *ElectTasksRequest
	AddRealtedTaskToEventReuqest *AddRealtedTaskToEventReuqest
	UpdateTaskStateRequest       *UpdateTaskStateRequest
	UpdateStateMetadataRequest   *UpdateStateMetadataRequest
}

type StateUpdateRequestMetadata added in v0.39.0

type StateUpdateRequestMetadata struct {
	CreatedAt time.Time
}

type TaskState

type TaskState struct {
	State  string    `yaml:"state"`
	Status string    `yaml:"status"`
	Task   task.Task `yaml:"task"`
	Output []byte    `yaml:"output"`
	Error  error     `yaml:"error"`
	Logger string    `yaml:"logger"`
}

TaskState is a representation of a state of one task

type UpdateStateMetadataRequest added in v0.39.0

type UpdateStateMetadataRequest struct {
	State  string
	Status string
}

type UpdateTaskStateRequest added in v0.39.0

type UpdateTaskStateRequest struct {
	State TaskState
}

Jump to

Keyboard shortcuts

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