state

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: BSD-3-Clause Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecordSnapshot added in v1.1.0

func RecordSnapshot(stateRecordingMode RecordingMode) bool

RecordSnapshot check to see if enbale snapshot recording

func RecordSteps added in v1.1.0

func RecordSteps(stateRecordingMode RecordingMode) bool

RecordSteps check to see if enbale step recording

func UpdateFlow

func UpdateFlow(s *SnapshotBase, change *change.Flow)
func UpdateLinks(snapshot *SnapshotBase, linkId int, change *change.Link)

func UpdateQueue

func UpdateQueue(fs *Snapshot, id int, queueChg *change.Queue, first *int) bool

func UpdateTasks

func UpdateTasks(snapshot *SnapshotBase, taskId string, change *change.Task)

Types

type FlowInfo

type FlowInfo struct {
	Id      string `json:"id"`
	FlowURI string `json:"flowURI"`
	Status  int    `json:"status"`
}
type Link struct {
	Id     int `json:"id"`
	Status int `json:"status"`
}

type Recorder

type Recorder interface {
	// RecordSnapshot records a Snapshot of the FlowInstance
	RecordSnapshot(snapshot *Snapshot) error

	// RecordStep records the changes for the current Step of the Flow Instance
	RecordStep(step *Step) error
}

Recorder is the interface that describes a service that can record snapshots and steps of a Flow Instance

type RecordingMode added in v1.1.0

type RecordingMode string
const (
	// RecordingModeOff indicates that the recording been turned off
	RecordingModeOff RecordingMode = "off"
	// RecordingModeDebugger incicates that the state recording store steps data as well as task's input
	RecordingModeDebugger RecordingMode = "debugger"
	// RecordingModeStep incicates that the state recording to store steps data only
	RecordingModeStep RecordingMode = "step"
	// RecordingModeFull incicates that the state recording to store both steps and snapshot data
	RecordingModeFull RecordingMode = "full"
	// RecordingModeSnapshot incicates that the state recording to store snapshot data only
	RecordingModeSnapshot RecordingMode = "snapshot"
)

func ToRecordingMode added in v1.1.0

func ToRecordingMode(mode interface{}) (RecordingMode, error)

ToRecordingMode convert data to recording model const

type Snapshot

type Snapshot struct {
	*SnapshotBase
	Id        string      `json:"id"`
	WorkQueue []*WorkItem `json:"workQueue,omitempty"`
	Subflows  []*Subflow  `json:"subflows,omitempty"`
}

func StepsToSnapshot

func StepsToSnapshot(flowId string, steps []*Step) *Snapshot

type SnapshotBase

type SnapshotBase struct {
	FlowURI string                 `json:"flowURI"`
	Status  int                    `json:"status"`
	Attrs   map[string]interface{} `json:"attrs,omitempty"`
	Tasks   []*Task                `json:"tasks,omitempty"`
	Links   []*Link                `json:"links,omitempty"`
}

type Step

type Step struct {
	Id           int                   `json:"id"`
	FlowId       string                `json:"flowId"`
	FlowChanges  map[int]*change.Flow  `json:"flowChanges"`
	QueueChanges map[int]*change.Queue `json:"queueChanges,omitempty"`
}

type Subflow

type Subflow struct {
	*SnapshotBase
	Id     int    `json:"id"`
	TaskId string `json:"taskId"`
}

type Task

type Task struct {
	Id     string `json:"id"`
	Status int    `json:"status"`
}

type WorkItem

type WorkItem struct {
	ID        int    `json:"id"`
	SubflowId int    `json:"subflowId"`
	TaskId    string `json:"taskId"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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