engine

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WorkflowRegistry map[string]reflect.Type

Functions

func RunWorkflow

func RunWorkflow(w Workflow, r repository.WorkflowRepository, wa repository.WorkflowActionRepository, executorID int64, workerID string)

Engine runs a workflow

func Worker

func Worker(id int, executorID int64, workflowRepository repository.WorkflowRepository, workflowActionRepository repository.WorkflowActionRepository, workflowQueue <-chan Workflow)

Worker function that processes workflows from the queue

Types

type Workflow

type Workflow interface {
	StateTransitions() map[string][]string // map of state name -> list of next state names
	InitialState() string
	Description() string
	Setup(wf *domain.Workflow)
	GetWorkflowData() *domain.Workflow
	GetStateVariables() map[string]string
	GetAllStates() []models.WorkflowState // where to start
	GetRetryConfig() models.RetryConfig
}

Workflow is the interface that all workflows must implement.

func CreateWorkflowInstance

func CreateWorkflowInstance(name string) (Workflow, error)

CreateWorkflowInstance exposes workflow instantiation for external packages (e.g., controllers).

type WorkflowManager

type WorkflowManager struct {
	WorkflowRepo       *repository.WorkflowRepository
	WorkflowActionRepo *repository.WorkflowActionRepository

	DefinitionRepo *repository.WorkflowDefinitionRepository
	// contains filtered or unexported fields
}

func NewWorkflowManager

func NewWorkflowManager(workflowRepo *repository.WorkflowRepository, workflowActionRepo *repository.WorkflowActionRepository, executorRepo *repository.ExecutorRepository,
	definitionRepo *repository.WorkflowDefinitionRepository) *WorkflowManager

func (*WorkflowManager) DefinitionOverview

func (wm *WorkflowManager) DefinitionOverview(workflowType string) ([]repository.DefinitionStateRow, error)

DefinitionOverview exposes counts by state for a workflow type

func (*WorkflowManager) GetWorkflowDefinitionByName

func (wm *WorkflowManager) GetWorkflowDefinitionByName(name string) (*domain.WorkflowDefinition, error)

GetWorkflowDefinitionByName exposes repository get by name for web/API layers.

func (*WorkflowManager) ListExecutors

func (wm *WorkflowManager) ListExecutors(limit int) ([]*domain.Executor, error)

ListExecutors returns recent executors ordered by last_active desc.

func (*WorkflowManager) ListWorkflowDefinitions

func (wm *WorkflowManager) ListWorkflowDefinitions() (*[]domain.WorkflowDefinition, error)

ListWorkflowDefinitions exposes repository list for web/API layers.

func (*WorkflowManager) NextToExecute

func (wm *WorkflowManager) NextToExecute(limit int) (*[]domain.Workflow, error)

NextToExecute exposes repository method for dashboard

func (*WorkflowManager) Overview

Overview exposes grouped counts for home dashboard

func (*WorkflowManager) SearchWorkflows

func (wm *WorkflowManager) SearchWorkflows(req models.SearchWorkflowRequest) (*[]domain.Workflow, error)

SearchWorkflows delegates to the repository to search based on request filters.

func (*WorkflowManager) StartEngine

func (wm *WorkflowManager) StartEngine(pollInterval time.Duration)

StartEngine starts polling for new workflows at the given interval

func (*WorkflowManager) TopExecuting

func (wm *WorkflowManager) TopExecuting(limit int) (*[]domain.Workflow, error)

TopExecuting exposes repository method for dashboard

func (*WorkflowManager) Wakeup

func (wm *WorkflowManager) Wakeup()

Jump to

Keyboard shortcuts

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