Documentation
¶
Overview ¶
Package steps defines the StepExecutor interface and a registry of built-in step type implementations for the workflow engine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainClient ¶
type ChainClient interface {
BroadcastTx(ctx context.Context, msgType string, params map[string]string) (*TxResult, error)
Query(ctx context.Context, path string, params map[string]string) (json.RawMessage, error)
}
ChainClient is the interface workflows use to interact with the chain. Implemented by the chain client package (Phase 1.8).
type CheckExecutor ¶
type CheckExecutor struct{}
CheckExecutor asserts a condition. If the condition is false, the step either skips or aborts based on on-fail.
func (*CheckExecutor) Execute ¶
func (e *CheckExecutor) Execute(ctx context.Context, step workflow.StepDef, state *workflow.RunState) (*workflow.StepResult, error)
func (*CheckExecutor) Type ¶
func (e *CheckExecutor) Type() workflow.StepType
type OutputExecutor ¶
type OutputExecutor struct {
// Out is the destination for rendered templates. Nil means os.Stdout.
Out io.Writer
}
OutputExecutor renders a Go template and writes it to Out (stdout by default). The rendered text is also recorded in the step result's Output under "text" so callers running in structured output modes (e.g. JSONL) can redirect Out and still access the rendered content.
func (*OutputExecutor) Execute ¶
func (e *OutputExecutor) Execute(ctx context.Context, step workflow.StepDef, state *workflow.RunState) (*workflow.StepResult, error)
func (*OutputExecutor) Type ¶
func (e *OutputExecutor) Type() workflow.StepType
type PromptExecutor ¶
type PromptExecutor struct{}
PromptExecutor handles interactive user input steps (e.g. bid selection).
func (*PromptExecutor) Execute ¶
func (e *PromptExecutor) Execute(ctx context.Context, step workflow.StepDef, state *workflow.RunState) (*workflow.StepResult, error)
func (*PromptExecutor) Type ¶
func (e *PromptExecutor) Type() workflow.StepType
type ProviderClient ¶
type ProviderClient interface {
SendManifest(ctx context.Context, provider string, dseq uint64, sdl []byte) error
SendManifestToActiveLeases(ctx context.Context, dseq uint64, sdl []byte) ([]string, error)
LeaseStatus(ctx context.Context, provider string, dseq uint64) (json.RawMessage, error)
}
ProviderClient is the interface for provider gateway operations. Implemented by the provider client package (Phase 2).
type ProviderExecutor ¶
type ProviderExecutor struct {
// contains filtered or unexported fields
}
ProviderExecutor handles provider gateway calls (send-manifest, lease-status, etc).
func (*ProviderExecutor) Execute ¶
func (e *ProviderExecutor) Execute(ctx context.Context, step workflow.StepDef, state *workflow.RunState) (*workflow.StepResult, error)
func (*ProviderExecutor) Type ¶
func (e *ProviderExecutor) Type() workflow.StepType
type QueryExecutor ¶
type QueryExecutor struct {
// contains filtered or unexported fields
}
QueryExecutor executes a chain query.
func (*QueryExecutor) Execute ¶
func (e *QueryExecutor) Execute(ctx context.Context, step workflow.StepDef, state *workflow.RunState) (*workflow.StepResult, error)
func (*QueryExecutor) Type ¶
func (e *QueryExecutor) Type() workflow.StepType
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps step types to their executors.
func NewRegistry ¶
func NewRegistry(chain ChainClient, provider ProviderClient) *Registry
NewRegistry creates a registry pre-loaded with all built-in step executors.
func (*Registry) Register ¶
func (r *Registry) Register(e workflow.StepExecutor)
Register adds or replaces an executor for a step type.
type ShellExecutor ¶
type ShellExecutor struct{}
ShellExecutor runs a shell command. For custom workflows.
func (*ShellExecutor) Execute ¶
func (e *ShellExecutor) Execute(ctx context.Context, step workflow.StepDef, state *workflow.RunState) (*workflow.StepResult, error)
func (*ShellExecutor) Type ¶
func (e *ShellExecutor) Type() workflow.StepType
type TxExecutor ¶
type TxExecutor struct {
// contains filtered or unexported fields
}
TxExecutor broadcasts a transaction to the chain.
func (*TxExecutor) Execute ¶
func (e *TxExecutor) Execute(ctx context.Context, step workflow.StepDef, state *workflow.RunState) (*workflow.StepResult, error)
func (*TxExecutor) Type ¶
func (e *TxExecutor) Type() workflow.StepType
type TxResult ¶
type TxResult struct {
TxHash string `json:"tx_hash"`
Height int64 `json:"height"`
Code uint32 `json:"code"`
Data json.RawMessage `json:"data,omitempty"`
}
TxResult holds the result of a broadcast transaction.
type WaitExecutor ¶
type WaitExecutor struct {
// contains filtered or unexported fields
}
WaitExecutor polls a query until a condition is met or timeout expires.
func NewWaitExecutor ¶ added in v0.0.5
func NewWaitExecutor(chain ChainClient, progress WaitProgressReporter) *WaitExecutor
NewWaitExecutor returns a wait executor with optional progress reporting.
func (*WaitExecutor) Execute ¶
func (e *WaitExecutor) Execute(ctx context.Context, step workflow.StepDef, state *workflow.RunState) (*workflow.StepResult, error)
func (*WaitExecutor) Type ¶
func (e *WaitExecutor) Type() workflow.StepType
type WaitProgress ¶ added in v0.0.5
type WaitProgress struct {
Step string
Query string
Elapsed time.Duration
Remaining time.Duration
Result json.RawMessage
}
WaitProgress describes one successful poll of a wait step.
type WaitProgressReporter ¶ added in v0.0.5
type WaitProgressReporter func(WaitProgress)
WaitProgressReporter receives successful wait polls. It is optional; the workflow engine itself never writes progress to a terminal.