state

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: BSD-3-Clause Imports: 5 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,omitempty"`
	FlowName      string `json:"flowName,omitempty"`
	Status        int    `json:"status,omitempty"`
	HostId        string `json:"hostid,omitempty"`
	FlowStatus    string `json:"flowStatus,omitempty"`
	StartTime     string `json:"starttime,omitempty"`
	EndTime       string `json:"endtime,omitempty"`
	ExecutionTime string `json:"executiontime,omitempty"`
}

type FlowState added in v1.6.0

type FlowState struct {
	UserId         string `json:"user_id"`
	AppName        string `json:"app_name"`
	AppVersion     string `json:"app_version"`
	HostId         string `json:"host_id"`
	FlowName       string `json:"flow_name"`
	FlowInstanceId string `json:"flow_instance_id"`
	FlowStats      string `json:"flow_stats"`
	//FlowInputs     map[string]interface{} `json:"flow_inputs"`
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`
}
type Link struct {
	Id     int `json:"id"`
	Status int `json:"status"`
}

type Recorder

type Recorder interface {
	RecordStart(state *FlowState) error
	// 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

	RecordDone(state *FlowState) 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 {
	//*Master
	Id           int                   `json:"id"`
	FlowId       string                `json:"flowId"`
	FlowChanges  map[int]*change.Flow  `json:"flowChanges"`
	QueueChanges map[int]*change.Queue `json:"queueChanges,omitempty"`
	StartTime    time.Time             `json:"starttime"`
	EndTime      time.Time             `json:"endtime"`
	Rerun        bool                  `json:"rerun"`
}

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