core

package
v0.0.0-...-307ba40 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name_PassState     = "Pass"
	Name_TaskState     = "Task"
	Name_ChoiceState   = "Choice"
	Name_WaitState     = "Wait"
	Name_ParallelState = "Parallel"
	Name_SucceedState  = "Succeed"
	Name_FailState     = "Fail"

	Errors_All           = "States.ALL"
	Errors_Timeout       = "States.Timeout"
	Errors_Failed        = "States.TaskFailed"
	Errors_Permissions   = "States.Permissions"
	Errors_ProcessFailed = "States.ProcessFailed"
)

Variables

This section is empty.

Functions

func BuildState

func BuildState(data []byte) (interface{}, error)

func ParseStateType

func ParseStateType(data []byte) (reflect.Type, error)

func Process

func Process(data []byte, path string) ([]byte, error)

Types

type AfantyCore

type AfantyCore struct {
	Name string
	// contains filtered or unexported fields
}

func NewAfantyInstance

func NewAfantyInstance(name string, options ...Option) *AfantyCore

func (*AfantyCore) Pub

func (c *AfantyCore) Pub(e Event) error

func (*AfantyCore) Shutdown

func (c *AfantyCore) Shutdown()

func (*AfantyCore) Sub

func (c *AfantyCore) Sub(name string, handler EventHandler) error

type BaseState

type BaseState struct {
	Type string
}

type Branches

type Branches struct {
	StartAt string
	States  map[string]*json.RawMessage
}

type Catcher

type Catcher struct {
	ErrorEquals []string
	Next        string
	ResultPath  string
}

type ChoiceRule

type ChoiceRule struct {
	Variable string
	Type     string
	// String, number, boolean, Timestamp or non-empty Array of ChoiceRule
	// which means ChoiceRule can be nested
	Target interface{}
	Next   string
}

type ChoiceState

type ChoiceState struct {
	// Choice states do not support the End field
	State
	Choices []*ChoiceRule
	Default string
}

type Event

type Event struct {
	Name string
	Ctx  context.Context
	// contains filtered or unexported fields
}

func NewEvent

func NewEvent(name string, ctx context.Context) *Event

func (*Event) WaitResult

func (e *Event) WaitResult() (interface{}, error)

type EventHandler

type EventHandler func(Event)

type FailState

type FailState struct {
	BaseState
	Comment string
	Cause   string
	Error   string
}

type Option

type Option func(*AfantyCore)

type ParallelState

type ParallelState struct {
	State
	Branches   []*Branches
	ResultPath string
	Retry      []*Retry
	Catch      []*Catcher
}

type PassState

type PassState struct {
	State
	Result     *json.RawMessage
	ResultPath string
}

type Retry

type Retry struct {
	ErrorEquals     []string
	IntervalSeconds float32
	MaxAttempts     int32
	// A number that is the multiplier by which the retry interval increases on each attempt (default 2.0).
	BackoffRate float32
}

type RetryContext

type RetryContext struct {
	StateErr  *StateError
	Times     int32
	StartTime time.Time
	Interval  time.Duration
	Fallback  bool
}

type State

type State struct {
	BaseState
	Next       string
	End        bool
	Comment    string
	InputPath  string
	OutputPath string
}

func ExecuteStateJSON

func ExecuteStateJSON(stateJSON json.RawMessage, data *json.RawMessage) (State, error)

type StateMachine

type StateMachine struct {
	Version        string
	Comment        string
	TimeoutSeconds int32
	StartAt        string
	States         map[string]*json.RawMessage
}

func NewStateMachineFromJSON

func NewStateMachineFromJSON(j []byte) (StateMachine, error)

func (*StateMachine) Execute

func (sm *StateMachine) Execute(data *json.RawMessage) error

type SucceedState

type SucceedState struct {
	BaseState
	Comment string
}

type TaskState

type TaskState struct {
	State
	Resource         string
	ResultPath       string
	Retry            []*Retry
	Catch            []*Catcher
	TimeoutSeconds   int32
	HeartbeatSeconds int32
}

func (*TaskState) Call

func (t *TaskState) Call(data *[]byte) (State, *StateError)

func (*TaskState) CatchFail

func (t *TaskState) CatchFail(err *StateError, data *[]byte) (State, error)

func (*TaskState) RetryWait

func (t *TaskState) RetryWait(ctx *RetryContext) (*RetryContext, bool)

type WaitState

type WaitState struct {
	State
	Seconds       int32
	Timestamp     string
	SecondsPath   string
	TimestampPath string
}

Jump to

Keyboard shortcuts

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