Versions in this module Expand all Collapse all v1 v1.0.0 Oct 15, 2021 Changes in this version + const FlowMaxAutoRetryTimes + func LoadUnCompletedWfRuntime(wfRuntime *WfRuntime, wf *ResourceWorkflow) error + type CreateHookFunc func(wfRuntime *WfRuntime) (WfHook, error) + type CreateMementoStorageFunc func(resource statemachine.StateResource) (WfRuntimeMementoStorage, error) + type CreateMetaLoaderFunc func(resourceType string) (WfMetaLoader, error) + type FlowMeta struct + FlowName string + RecoverFromFirstStep bool + Steps []*StepMeta + type FlowStatusType string + const FlowStatusCompleted + const FlowStatusFailed + const FlowStatusFailedCompleted + const FlowStatusPrepared + const FlowStatusRunning + const FlowStatusWaiting + type Recover interface + CancelResourceRecover func(resource statemachine.StateResource, conf map[define.WFConfKey]string) error + GetResourceRecoverInfo func(resource statemachine.StateResource, conf map[define.WFConfKey]string) (recover bool, preStatus statemachine.State) + SaveResourceInterruptInfo func(resource statemachine.StateResource, conf map[define.WFConfKey]string, ...) error + type ResourceWorkflow struct + Logger logr.Logger + MementoCareTaker *WfRuntimeMementoCareTaker + Resource statemachine.StateResource + WfManager *WfManager + func CreateResourceWorkflow(resource statemachine.StateResource, wfManager *WfManager) (*ResourceWorkflow, error) + func (m *ResourceWorkflow) CommonWorkFlowMainEnter(ctx context.Context, resource statemachine.StateResource, flowName string, ...) error + func (m *ResourceWorkflow) GetLastUnCompletedRuntime() (*WfRuntime, error) + func (m *ResourceWorkflow) RetryInterruptedStep() error + func (m *ResourceWorkflow) Run(ctx context.Context, flowName string, initContext map[string]interface{}) (err error) + func (m *ResourceWorkflow) RunLastUnCompletedRuntime(ctx context.Context, flowName string, ignoreOtherUnCompleted bool) (oldWfName string, isWaiting bool, err error) + func (m *ResourceWorkflow) RunUnCompletedRuntime(ctx context.Context, wfRuntime *WfRuntime) error + type StepAction interface + DoStep func(context.Context, logr.Logger) error + Init func(map[string]interface{}, logr.Logger) error + Output func(logr.Logger) map[string]interface{} + type StepGroupMeta struct + GroupName string + Steps []*StepMeta + type StepMeta struct + ClassName string + StepName string + type StepRuntime struct + ContextOutput map[string]interface{} + LastStepCompleteTime string + RetryTimes int + StepName string + StepStartTime string + StepStatus StepStatusType + type StepStatusType string + const StepStatusCompleted + const StepStatusFailed + const StepStatusInited + const StepStatusPrepared + const StepStatusWaiting + type WfHook interface + OnStepCompleted func(step *StepRuntime) error + OnStepInit func(step *StepRuntime) error + OnStepWaiting func(step *StepRuntime) error + OnWfCompleted func() error + OnWfInit func() error + OnWfInterrupt func(*define.InterruptError) error + type WfManager struct + FlowMetaMap map[string]*FlowMeta + Logger logr.Logger + ResourceType string + TypeRegistry map[string]reflect.Type + func CreateWfManager(resourceType string, workFlowMetaDir string, ...) (*WfManager, error) + func (m *WfManager) CheckRecovery(resource statemachine.StateResource) bool + func (m *WfManager) CreateResourceWorkflow(resource statemachine.StateResource) (*ResourceWorkflow, error) + func (m *WfManager) GetConfItem(confKey define.WFConfKey) string + func (m *WfManager) RegisterConf(conf map[define.WFConfKey]string) + func (m *WfManager) RegisterLogger(logger logr.Logger) *WfManager + func (m *WfManager) RegisterRecover(recover Recover) *WfManager + func (m *WfManager) RegisterStep(step StepAction) + func (m *WfManager) RegisterSteps(steps ...StepAction) + type WfMetaLoader interface + GetAllFlowMeta func(workFlowMetaDir string) (map[string]*FlowMeta, map[string]*StepGroupMeta, error) + type WfRuntime struct + CompleteTime string + ErrorMessage string + FlowHookIns WfHook + FlowName string + FlowStatus FlowStatusType + IgnoreError bool + InitContext map[string]interface{} + Logger logr.Logger + ResourceWorkflow *ResourceWorkflow + RetryTimes int + RunningSteps []*StepRuntime + StartTime string + func CreateWfRuntime(flowName string, flowContext map[string]interface{}, wf *ResourceWorkflow) (*WfRuntime, error) + func (r *WfRuntime) NewStepActionIns(stepMeta *StepMeta) (StepAction, error) + func (r *WfRuntime) Start(ctx context.Context) (err error) + type WfRuntimeMemento struct + type WfRuntimeMementoCareTaker struct + FlowApplyResource string + MementoMap map[string]string + MementoStorage WfRuntimeMementoStorage + Name string + Namespace string + func CreateWfRuntimeMementoCareTaker(resource statemachine.StateResource, ...) (*WfRuntimeMementoCareTaker, error) + func (cm *WfRuntimeMementoCareTaker) CreateMemento(flowName string) (*WfRuntimeMemento, error) + func (cm *WfRuntimeMementoCareTaker) GetAllUnCompletedWorkflowRuntime() (map[string]*WfRuntime, error) + func (cm *WfRuntimeMementoCareTaker) GetLastWorkflowRuntime() (string, *WfRuntime, error) + func (cm *WfRuntimeMementoCareTaker) LoadMemento(wf *WfRuntime) (*WfRuntimeMemento, error) + func (cm *WfRuntimeMementoCareTaker) SaveMemento(memento *WfRuntimeMemento) error + type WfRuntimeMementoStorage interface + LoadMementoMap func(careTakerName string) (map[string]string, error) + Save func(mementoKey, mementoContent string) error