Documentation
¶
Index ¶
- Variables
- func ActivityName(ctx context.Context) string
- func ActivityToken(ctx context.Context) string
- func Config(ctx context.Context, key string) (interface{}, bool)
- func ConfigString(ctx context.Context, key string) (string, bool)
- func IsNonRestorable(ctx context.Context) bool
- func Logger(ctx context.Context) *slog.Logger
- func RouteTo(nodeKey string) error
- func WithNonRestorable(ctx context.Context) context.Context
- func WithWorkflowID(ctx context.Context, id string) context.Context
- func WorkflowID(ctx context.Context) string
- type Activity
- type DynamicRoute
- type Edge
- type Middleware
- type Node
- type NodeOption
- type NodeType
- type Orchestrator
- func (o *Orchestrator) GetActivity(node *Node) (Activity, bool)
- func (o *Orchestrator) GetNode(graphNode graph.Node) (*Node, bool)
- func (o *Orchestrator) GetReducer(node *Node) (Reducer, bool)
- func (o *Orchestrator) LoadWorkflow(w *Workflow)
- func (o *Orchestrator) RegisterActivity(name string, activity Activity)
- func (o *Orchestrator) RegisterReducer(name string, reducer Reducer)
- func (o *Orchestrator) RestorableWorkflows(ctx context.Context) (RestorableWorkflows, error)
- func (o *Orchestrator) RestoreWorkflowsAsync(ctx context.Context) error
- func (o *Orchestrator) RunTriggers(ctx context.Context, input []byte) ([]byte, error)
- func (o *Orchestrator) Start(ctx context.Context, data []byte) (output []byte, err error)
- func (o *Orchestrator) StartAsync(ctx context.Context, data []byte) (output []byte, err error)
- func (o *Orchestrator) Use(mw Middleware)
- type OrchestratorOption
- type Reducer
- type RestorableWorkflows
- type RetryPolicy
- type Workflow
- func (wf *Workflow) AddEdge(edge *Edge) error
- func (wf *Workflow) AddNode(node *Node) *Workflow
- func (wf *Workflow) AddNodes(nodes ...*Node) *Workflow
- func (wf *Workflow) Export() ([]byte, error)
- func (wf *Workflow) ExportDot(name, indent string) []byte
- func (wf *Workflow) ExportDotToFile(filename string) error
- func (wf *Workflow) ExportMermaid(name, indent string) []byte
- func (wf *Workflow) ExportMermaidToFile(filename string) error
- func (wf *Workflow) Import(workflow []byte) error
- func (wf *Workflow) Link(from, to string) *Workflow
- func (wf *Workflow) Then(node *Node) *Workflow
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNodeNotFound = fmt.Errorf("node not found") ErrWorkflowNodeAlreadyExists = fmt.Errorf("node already exists") ErrWorkflowInvalid = fmt.Errorf("invalid, it has no trigger or no starting node") ErrWorkflowHasNoTriggers = fmt.Errorf("no triggers found") ErrWorkflowHasNoNodes = fmt.Errorf("workflow has no nodes") ErrOrchestratorActivityNotFound = fmt.Errorf("activity not found") ErrOrchestratorHasNoPersister = fmt.Errorf("no persister set") ErrNoWorkflowID = fmt.Errorf("no execution ID set") )
Functions ¶
func ActivityName ¶
func ActivityToken ¶
func IsNonRestorable ¶
func WorkflowID ¶
Types ¶
type DynamicRoute ¶
func (*DynamicRoute) Error ¶
func (e *DynamicRoute) Error() string
func (*DynamicRoute) MarshalJSON ¶
func (e *DynamicRoute) MarshalJSON() ([]byte, error)
func (*DynamicRoute) UnmarshalJSON ¶
func (e *DynamicRoute) UnmarshalJSON(data []byte) error
func (*DynamicRoute) Unwrap ¶
func (e *DynamicRoute) Unwrap() error
type Middleware ¶
type Node ¶
type Node struct {
ID int64 `json:"id"`
ActivityName string `json:"activity"`
Config map[string]interface{} `json:"config,omitempty"`
Type NodeType `json:"type,omitempty"`
RetryPolicy *RetryPolicy `json:"retry,omitempty"`
}
func NewNode ¶
func NewNode(activity string, options ...NodeOption) *Node
func (*Node) IsRetryableError ¶
func (*Node) RetryPolicyOrDefault ¶
func (n *Node) RetryPolicyOrDefault(d *RetryPolicy) *RetryPolicy
type NodeOption ¶
type NodeOption func(*Node)
func WithNodeConfig ¶
func WithNodeConfig(config map[string]interface{}) NodeOption
func WithNodeID ¶
func WithNodeID(id int64) NodeOption
func WithNodeRetryPolicy ¶
func WithNodeRetryPolicy(policy *RetryPolicy) NodeOption
func WithNodeType ¶
func WithNodeType(t NodeType) NodeOption
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
func NewOrchestrator ¶
func NewOrchestrator(options ...OrchestratorOption) *Orchestrator
func NewOrchestratorWithWorkflow ¶ added in v0.2.0
func NewOrchestratorWithWorkflow(w *Workflow, options ...OrchestratorOption) *Orchestrator
func (*Orchestrator) GetActivity ¶
func (o *Orchestrator) GetActivity(node *Node) (Activity, bool)
func (*Orchestrator) GetReducer ¶
func (o *Orchestrator) GetReducer(node *Node) (Reducer, bool)
func (*Orchestrator) LoadWorkflow ¶
func (o *Orchestrator) LoadWorkflow(w *Workflow)
func (*Orchestrator) RegisterActivity ¶
func (o *Orchestrator) RegisterActivity(name string, activity Activity)
func (*Orchestrator) RegisterReducer ¶
func (o *Orchestrator) RegisterReducer(name string, reducer Reducer)
func (*Orchestrator) RestorableWorkflows ¶
func (o *Orchestrator) RestorableWorkflows(ctx context.Context) (RestorableWorkflows, error)
func (*Orchestrator) RestoreWorkflowsAsync ¶
func (o *Orchestrator) RestoreWorkflowsAsync(ctx context.Context) error
func (*Orchestrator) RunTriggers ¶
func (*Orchestrator) StartAsync ¶
func (*Orchestrator) Use ¶
func (o *Orchestrator) Use(mw Middleware)
type OrchestratorOption ¶
type OrchestratorOption func(*Orchestrator)
func WithDefaultRetryPolicy ¶ added in v0.2.0
func WithDefaultRetryPolicy(policy *RetryPolicy) OrchestratorOption
func WithLogger ¶
func WithLogger(logger *slog.Logger) OrchestratorOption
func WithPersistence ¶
func WithPersistence(persister persistence.Persister) OrchestratorOption
type RestorableWorkflows ¶
RestorableWorkflows returns a map of workflowName to a map of workflowID to a an array of node functions that allow the client to restore them.
type RetryPolicy ¶
type Workflow ¶
type Workflow struct {
Name string `json:"name"`
Nodes map[string]*Node `json:"nodes"`
Edges []*Edge `json:"edges"`
// contains filtered or unexported fields
}
func NewWorkflow ¶
func (*Workflow) ExportDotToFile ¶
func (*Workflow) ExportMermaid ¶
ExportMermaid generates the Mermaid representation of the workflow.
func (*Workflow) ExportMermaidToFile ¶
ExportMermaidToFile writes the generated Mermaid diagram to a file.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
abm
command
|
|
|
childworkflow
command
|
|
|
cron
command
|
|
|
fbp
command
|
|
|
middlewares
command
|
|
|
parallel
command
|
|
|
webhook
command
|
|
Click to show internal directories.
Click to hide internal directories.