Documentation
¶
Index ¶
- func InjectDefaults(inputType reflect.Type, inputMap map[string]interface{}) error
- func NewTaskExecutionContext(taskCtx jobworkflow.TaskContext) (context.Context, context.CancelFunc)
- func Register(r *ActivityRegistry, activity ops.RegisterableOp) error
- type ActivityInvocationOutput
- type ActivityInvocationOutputRaw
- type ActivityInvocationRequest
- type ActivityRegisterable
- type ActivityRegistration
- type ActivityRegistry
- func (r *ActivityRegistry) Dependencies() ops.ServiceDependencies2
- func (r *ActivityRegistry) EnableActivitiesInWorker(deps ops.ServiceDependencies2, worker ActivityRegisterable)
- func (r *ActivityRegistry) Get(taskType string) (ActivityRegistration, bool)
- func (r *ActivityRegistry) GetAll() map[string]ActivityRegistration
- func (r *ActivityRegistry) GetTaskWorkers(deps ops.ServiceDependencies2) []jobworkflow.TaskWorker
- func (r *ActivityRegistry) List() []string
- func (r *ActivityRegistry) Register(activity ops.RegisterableOp) error
- func (r *ActivityRegistry) RegisterFunc(name string, ...) error
- func (r *ActivityRegistry) SetDependencies(deps ops.ServiceDependencies2)
- func (r *ActivityRegistry) UpdateRegistration(activityType string, registration ActivityRegistration)
- type ConsumeArtifactInput
- type ConsumeArtifactOutput
- type DefaultSchemaGenerator
- type EmitArtifactOutput
- type GenericActivityFunc
- type GenericInput
- type GenericOutput
- type NextTaskOverrideInput
- type NextTaskOverrideOutput
- type SchemaGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InjectDefaults ¶
InjectDefaults adds default values to the input map for fields that are missing. Defaults are injected as strings and will be resolved by the template system. This function recursively handles nested structs at arbitrary depth.
func NewTaskExecutionContext ¶ added in v0.0.14
func NewTaskExecutionContext(taskCtx jobworkflow.TaskContext) (context.Context, context.CancelFunc)
NewTaskExecutionContext returns a context that is canceled when the SWF task context reports its durable deadline has elapsed. The deadline source remains SWF chapter metadata, not c2j wall-clock bookkeeping, so replay keeps the original task/job start time semantics.
func Register ¶
func Register(r *ActivityRegistry, activity ops.RegisterableOp) error
Register accepts any generic RegisterableOp from the activity module
Types ¶
type ActivityInvocationOutput ¶
type ActivityInvocationOutput struct {
Execution *execution.Requirements `json:"execution,omitempty"`
GitResult contextual.GitCommitContext `json:"git,omitempty"`
NextTask string `json:"nextTaskType,omitempty"`
OpOutput map[string]interface{} `json:"output"`
ArtifactRefs map[string]recipeartifacts.Ref `json:"artifact_refs,omitempty"`
Jobs jobcontext.StartedJobsContext `json:"jobs,omitempty"`
}
ActivityInvocationOutput wraps the raw op output alongside workspace results.
type ActivityInvocationOutputRaw ¶
type ActivityInvocationOutputRaw struct {
Execution *execution.Requirements `json:"execution,omitempty"`
GitResult contextual.GitCommitContext `json:"git,omitempty"`
NextTask string `json:"nextTaskType,omitempty"`
Output any `json:"output"`
ArtifactRefs map[string]recipeartifacts.Ref `json:"artifact_refs,omitempty"`
Jobs jobcontext.StartedJobsContext `json:"jobs,omitempty"`
}
variation of ActivityInvocationOutput that allows arbitrary output types to avoid double serialization
type ActivityInvocationRequest ¶
type ActivityInvocationRequest struct {
Input map[string]interface{} `json:"input"`
Const bool `json:"const,omitempty"`
GitTaskContext gitstate.GlobalGitTaskContext `json:"context"`
ArtifactKeys []jobdb.ArtifactKey `json:"artifact_keys,omitempty"`
Artifacts map[string]recipeartifacts.Ref `json:"artifacts,omitempty"`
Deps ops.OpDependencies `json:"-"`
}
ActivityInvocationRequest wraps the invocation metadata and original input payload.
type ActivityRegisterable ¶
type ActivityRegisterable interface {
RegisterActivityWithOptions(a interface{}, options activity.RegisterOptions)
}
type ActivityRegistration ¶
type ActivityRegistration struct {
Activity ops.RegisterableOp // parent op
Step ops.TaskStep
StepIndex int
TaskType string // opType:stepName
NextTaskType string
InputSchema *jsonschema.Schema
OutputSchema *jsonschema.Schema
Metadata ops.OpMetadata
}
ActivityRegistration holds the activity step and its generated schemas.
type ActivityRegistry ¶
type ActivityRegistry struct {
// contains filtered or unexported fields
}
ActivityRegistry manages all registered activities
func NewActivityRegistry ¶
func NewActivityRegistry() (*ActivityRegistry, error)
NewActivityRegistry creates a new activity registry
func (*ActivityRegistry) Dependencies ¶
func (r *ActivityRegistry) Dependencies() ops.ServiceDependencies2
Dependencies exposes the current dependency container (may be nil).
func (*ActivityRegistry) EnableActivitiesInWorker ¶
func (r *ActivityRegistry) EnableActivitiesInWorker(deps ops.ServiceDependencies2, worker ActivityRegisterable)
func (*ActivityRegistry) Get ¶
func (r *ActivityRegistry) Get(taskType string) (ActivityRegistration, bool)
Get retrieves an activity registration by task type
func (*ActivityRegistry) GetAll ¶
func (r *ActivityRegistry) GetAll() map[string]ActivityRegistration
GetAll returns all activity registrations
func (*ActivityRegistry) GetTaskWorkers ¶
func (r *ActivityRegistry) GetTaskWorkers(deps ops.ServiceDependencies2) []jobworkflow.TaskWorker
func (*ActivityRegistry) List ¶
func (r *ActivityRegistry) List() []string
List returns all registered activity types
func (*ActivityRegistry) Register ¶
func (r *ActivityRegistry) Register(activity ops.RegisterableOp) error
func (*ActivityRegistry) RegisterFunc ¶
func (*ActivityRegistry) SetDependencies ¶
func (r *ActivityRegistry) SetDependencies(deps ops.ServiceDependencies2)
SetDependencies makes a dependency container available for invocations produced by this registry.
func (*ActivityRegistry) UpdateRegistration ¶
func (r *ActivityRegistry) UpdateRegistration(activityType string, registration ActivityRegistration)
UpdateRegistration updates an existing activity registration This is used by the schema manager to update schemas after generation
type ConsumeArtifactInput ¶
type ConsumeArtifactInput struct {
Artifact jobdb.ArtifactKey `json:"artifact" validate:"required"`
}
type ConsumeArtifactOutput ¶
type ConsumeArtifactOutput struct {
Name string `json:"name"`
}
type DefaultSchemaGenerator ¶
type DefaultSchemaGenerator struct {
// contains filtered or unexported fields
}
DefaultSchemaGenerator uses invopop/jsonschema for schema generation
func NewDefaultSchemaGenerator ¶
func NewDefaultSchemaGenerator() *DefaultSchemaGenerator
NewDefaultSchemaGenerator creates a new schema generator
func (*DefaultSchemaGenerator) GenerateSchema ¶
func (g *DefaultSchemaGenerator) GenerateSchema(typ reflect.Type) (*jsonschema.Schema, error)
GenerateSchema creates a JSON schema from a Go type
func (*DefaultSchemaGenerator) ValidateStructTags ¶
func (g *DefaultSchemaGenerator) ValidateStructTags(typ reflect.Type) error
ValidateStructTags ensures all fields have explicit json tags
type EmitArtifactOutput ¶
type EmitArtifactOutput struct {
Name string `json:"name"`
}
type GenericInput ¶
type GenericInput struct {
Message string `json:"message,omitempty"`
Command string `json:"command,omitempty"`
Text string `json:"text,omitempty"`
Name string `json:"name,omitempty"`
Run string `json:"run,omitempty"`
Duration string `json:"duration,omitempty"`
Data interface{} `json:"data,omitempty"`
Items []interface{} `json:"items,omitempty"`
Error bool `json:"error,omitempty"`
Extra map[string]interface{} `json:"-" mapstructure:",remain"`
}
Test activity input/output types
type GenericOutput ¶
type GenericOutput struct {
// String outputs
Result interface{} `json:"result,omitempty"`
Output string `json:"output,omitempty"`
Status string `json:"status,omitempty"`
Stdout string `json:"stdout,omitempty"`
Report string `json:"report,omitempty"`
Response string `json:"response,omitempty"`
Body string `json:"body,omitempty"`
Slept string `json:"slept,omitempty"`
Action string `json:"action,omitempty"`
Handler string `json:"handler,omitempty"`
Processor string `json:"processor,omitempty"`
Recipe string `json:"recipe,omitempty"`
// Boolean outputs
Logged bool `json:"logged,omitempty"`
Valid bool `json:"valid,omitempty"`
// Numeric outputs
Count int `json:"count,omitempty"`
Confidence float64 `json:"confidence,omitempty"`
// Complex outputs
Model interface{} `json:"model,omitempty"`
Data interface{} `json:"data,omitempty"`
Items []interface{} `json:"items,omitempty"`
}
type NextTaskOverrideInput ¶
type NextTaskOverrideInput struct {
Message string `json:"message"`
}
type NextTaskOverrideOutput ¶
type SchemaGenerator ¶
type SchemaGenerator interface {
GenerateSchema(typ reflect.Type) (*jsonschema.Schema, error)
ValidateStructTags(typ reflect.Type) error
}
SchemaGenerator validates struct tags and generates JSON schemas This is internal to recipe-worker