Documentation
¶
Index ¶
- Constants
- Variables
- func CanTransition(from, to Status) bool
- func IsTerminal(status Status) bool
- type EventType
- type GormStore
- func (s *GormStore) AppendEvent(ctx context.Context, event RunEvent) error
- func (s *GormStore) Events(ctx context.Context, runID string) ([]RunEvent, error)
- func (s *GormStore) FailInterruptedRuns(ctx context.Context) (int, error)
- func (s *GormStore) ListRuns(ctx context.Context) ([]*WorkflowRun, error)
- func (s *GormStore) LoadRun(ctx context.Context, runID string) (*WorkflowRun, error)
- func (s *GormStore) SaveRun(ctx context.Context, run *WorkflowRun) error
- func (s *GormStore) SaveSnapshot(ctx context.Context, snapshot *RunSnapshot) error
- func (s *GormStore) Snapshots(ctx context.Context, runID string) ([]*RunSnapshot, error)
- type MemoryStore
- func (s *MemoryStore) AppendEvent(_ context.Context, event RunEvent) error
- func (s *MemoryStore) Events(_ context.Context, runID string) ([]RunEvent, error)
- func (s *MemoryStore) ListRuns(_ context.Context) ([]*WorkflowRun, error)
- func (s *MemoryStore) LoadRun(_ context.Context, runID string) (*WorkflowRun, error)
- func (s *MemoryStore) SaveRun(_ context.Context, run *WorkflowRun) error
- func (s *MemoryStore) SaveSnapshot(_ context.Context, snapshot *RunSnapshot) error
- func (s *MemoryStore) Snapshots(_ context.Context, runID string) ([]*RunSnapshot, error)
- type NodeRun
- type RunContext
- type RunEvent
- type RunSnapshot
- type Status
- type Store
- type WorkflowRun
Constants ¶
View Source
const InterruptedRunMessage = "server restarted before the run completed"
Variables ¶
View Source
var ErrRunNotFound = errors.New("run not found")
Functions ¶
func CanTransition ¶
func IsTerminal ¶
Types ¶
type EventType ¶
type EventType string
const ( EventRunStarted EventType = "run_started" EventRunFinished EventType = "run_finished" EventRunPaused EventType = "run_paused" EventRunResumed EventType = "run_resumed" EventNodeReady EventType = "node_ready" EventNodeRunning EventType = "node_running" EventNodeLoop EventType = "node_loop" EventNodeRetry EventType = "node_retry" EventNodeDone EventType = "node_done" EventNodeFailed EventType = "node_failed" )
type GormStore ¶
type GormStore struct {
// contains filtered or unexported fields
}
func NewGormStore
deprecated
func (*GormStore) AppendEvent ¶
func (*GormStore) FailInterruptedRuns ¶
func (*GormStore) ListRuns ¶
func (s *GormStore) ListRuns(ctx context.Context) ([]*WorkflowRun, error)
func (*GormStore) SaveRun ¶
func (s *GormStore) SaveRun(ctx context.Context, run *WorkflowRun) error
func (*GormStore) SaveSnapshot ¶
func (s *GormStore) SaveSnapshot(ctx context.Context, snapshot *RunSnapshot) error
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func (*MemoryStore) AppendEvent ¶
func (s *MemoryStore) AppendEvent(_ context.Context, event RunEvent) error
func (*MemoryStore) ListRuns ¶
func (s *MemoryStore) ListRuns(_ context.Context) ([]*WorkflowRun, error)
func (*MemoryStore) LoadRun ¶
func (s *MemoryStore) LoadRun(_ context.Context, runID string) (*WorkflowRun, error)
func (*MemoryStore) SaveRun ¶
func (s *MemoryStore) SaveRun(_ context.Context, run *WorkflowRun) error
func (*MemoryStore) SaveSnapshot ¶
func (s *MemoryStore) SaveSnapshot(_ context.Context, snapshot *RunSnapshot) error
func (*MemoryStore) Snapshots ¶
func (s *MemoryStore) Snapshots(_ context.Context, runID string) ([]*RunSnapshot, error)
type NodeRun ¶
type NodeRun struct {
NodeID string `json:"node_id"`
Status Status `json:"status"`
Attempt int `json:"attempt"`
MaxAttempts int `json:"max_attempts,omitempty"`
StartedAt time.Time `json:"started_at,omitempty"`
FinishedAt time.Time `json:"finished_at,omitempty"`
// Input keeps the latest materialized task input so the UI can explain what
// a node actually received during execution instead of only showing config.
Input any `json:"input,omitempty"`
Result any `json:"result,omitempty"`
Error string `json:"error,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
type RunContext ¶
type RunEvent ¶
type RunEvent struct {
RunID string `json:"run_id"`
Type EventType `json:"type"`
NodeID string `json:"node_id,omitempty"`
Status Status `json:"status,omitempty"`
Time time.Time `json:"time"`
Message string `json:"message,omitempty"`
Payload map[string]any `json:"payload,omitempty"`
WorkflowID string `json:"workflow_id,omitempty"`
}
type RunSnapshot ¶
type Store ¶
type Store interface {
SaveRun(ctx context.Context, run *WorkflowRun) error
LoadRun(ctx context.Context, runID string) (*WorkflowRun, error)
ListRuns(ctx context.Context) ([]*WorkflowRun, error)
SaveSnapshot(ctx context.Context, snapshot *RunSnapshot) error
Snapshots(ctx context.Context, runID string) ([]*RunSnapshot, error)
AppendEvent(ctx context.Context, event RunEvent) error
Events(ctx context.Context, runID string) ([]RunEvent, error)
}
type WorkflowRun ¶
type WorkflowRun struct {
ID string `json:"id"`
WorkflowID string `json:"workflow_id"`
WorkflowVersionID string `json:"workflow_version_id"`
PlanID string `json:"plan_id"`
RequestFingerprint string `json:"request_fingerprint,omitempty"`
CredentialScope string `json:"credential_scope,omitempty"`
Status Status `json:"status"`
CurrentNodes []string `json:"current_nodes,omitempty"`
NodeRuns map[string]*NodeRun `json:"node_runs,omitempty"`
Context RunContext `json:"context"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
StartedAt time.Time `json:"started_at,omitempty"`
FinishedAt time.Time `json:"finished_at,omitempty"`
// contains filtered or unexported fields
}
func NewWorkflowRun ¶
func NewWorkflowRun(runID, workflowID, versionID, planID string) *WorkflowRun
func (*WorkflowRun) Clone ¶
func (r *WorkflowRun) Clone() *WorkflowRun
Click to show internal directories.
Click to hide internal directories.