server

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host            string
	Port            int
	Concurrency     int
	Timeout         time.Duration
	EnableMetrics   bool
	EnableCORS      bool
	WorkflowFiles   []string
	WorkflowDir     string
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	IdleTimeout     time.Duration
	ShutdownTimeout time.Duration
}

Config holds the server configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default server configuration

type ExecutionManager

type ExecutionManager struct {
	// contains filtered or unexported fields
}

ExecutionManager handles concurrent workflow executions

func NewExecutionManager

func NewExecutionManager(maxConcurrency int) *ExecutionManager

NewExecutionManager creates a new execution manager

func NewExecutionManagerWithRegistry

func NewExecutionManagerWithRegistry(maxConcurrency int, registerer prometheus.Registerer) *ExecutionManager

NewExecutionManagerWithRegistry creates a new execution manager with a custom registry

func (*ExecutionManager) AddProgressEvent

func (em *ExecutionManager) AddProgressEvent(runID string, event pkgEvents.ExecutionEvent)

AddProgressEvent adds a progress event to an execution

func (*ExecutionManager) CanStartExecution

func (em *ExecutionManager) CanStartExecution() bool

CanStartExecution checks if a new execution can be started

func (*ExecutionManager) FinishExecution

func (em *ExecutionManager) FinishExecution(runID string, outputs map[string]any, err error)

FinishExecution marks an execution as finished

func (*ExecutionManager) GetActiveExecutions

func (em *ExecutionManager) GetActiveExecutions() int

GetActiveExecutions returns the number of active executions

func (*ExecutionManager) GetExecution

func (em *ExecutionManager) GetExecution(runID string) (*ExecutionStatus, bool)

GetExecution retrieves an execution status

func (*ExecutionManager) StartExecution

func (em *ExecutionManager) StartExecution(runID, workflowID string, cancel context.CancelFunc, inputs map[string]any) *ExecutionStatus

StartExecution starts tracking a new execution

func (*ExecutionManager) StartListening

func (em *ExecutionManager) StartListening(progressChan <-chan pkgEvents.ExecutionEvent)

func (*ExecutionManager) StopListening

func (em *ExecutionManager) StopListening()

type ExecutionStatus

type ExecutionStatus struct {
	RunID      string                     `json:"run_id"`
	WorkflowID string                     `json:"workflow_id"`
	Status     string                     `json:"status"`
	StartTime  time.Time                  `json:"start_time"`
	EndTime    *time.Time                 `json:"end_time,omitempty"`
	Duration   time.Duration              `json:"duration"`
	Inputs     map[string]any             `json:"inputs"`
	Outputs    map[string]any             `json:"outputs,omitempty"`
	Error      string                     `json:"error,omitempty"`
	Progress   []pkgEvents.ExecutionEvent `json:"progress,omitempty"`
	// contains filtered or unexported fields
}

ExecutionStatus represents the status of a workflow execution

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents the Lacquer HTTP server

func New

func New(config *Config) (*Server, error)

New creates a new Lacquer server

func (*Server) GetAddr

func (s *Server) GetAddr() string

GetAddr returns the server address

func (*Server) GetWorkflowCount

func (s *Server) GetWorkflowCount() int

GetWorkflowCount returns the number of loaded workflows

func (*Server) LoadWorkflows

func (s *Server) LoadWorkflows() error

LoadWorkflows loads and validates workflows from the configuration

func (*Server) Start

func (s *Server) Start() error

Start starts the HTTP server

func (*Server) StartWithGracefulShutdown

func (s *Server) StartWithGracefulShutdown() error

StartWithGracefulShutdown starts the server and handles graceful shutdown

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stops the HTTP server gracefully

type WorkflowRegistry

type WorkflowRegistry struct {
	// contains filtered or unexported fields
}

WorkflowRegistry holds validated workflows

func NewWorkflowRegistry

func NewWorkflowRegistry() *WorkflowRegistry

NewWorkflowRegistry creates a new workflow registry

func (*WorkflowRegistry) Count

func (r *WorkflowRegistry) Count() int

Count returns the number of registered workflows

func (*WorkflowRegistry) Get

func (r *WorkflowRegistry) Get(id string) (*ast.Workflow, bool)

Get retrieves a workflow by ID

func (*WorkflowRegistry) List

func (r *WorkflowRegistry) List() []string

List returns all workflow IDs

func (*WorkflowRegistry) Register

func (r *WorkflowRegistry) Register(id string, workflow *ast.Workflow)

Register adds a workflow to the registry

Jump to

Keyboard shortcuts

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