Documentation
¶
Index ¶
- Variables
- type ActivityTask
- type ActivityTaskActivityType
- type ActivityType
- type ActivityTypeDefaults
- type CancelTimerDecisionAttrs
- type CancelWorkflowExecutionDecisionAttrs
- type CompleteWorkflowExecutionDecisionAttrs
- type ContinueAsNewWorkflowExecutionDecisionAttrs
- type Decision
- type DecisionTask
- type Domain
- type ExecutionFilter
- type FailWorkflowExecutionDecisionAttrs
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type HistoryEvent
- type InMemoryBackend
- func (b *InMemoryBackend) AccountID() string
- func (b *InMemoryBackend) AddActivityTypeInternal(domain, name, version, status string)
- func (b *InMemoryBackend) AddWorkflowTypeInternal(domain, name, version, status string)
- func (b *InMemoryBackend) CountClosedWorkflowExecutions(domain string, filter ExecutionFilter) int
- func (b *InMemoryBackend) CountOpenWorkflowExecutions(domain string, filter ExecutionFilter) int
- func (b *InMemoryBackend) CountPendingActivityTasks(domain, taskList string) int
- func (b *InMemoryBackend) CountPendingDecisionTasks(domain, taskList string) int
- func (b *InMemoryBackend) DeleteActivityType(domain, name, version string) error
- func (b *InMemoryBackend) DeleteWorkflowType(domain, name, version string) error
- func (b *InMemoryBackend) DeprecateActivityType(domain, name, version string) error
- func (b *InMemoryBackend) DeprecateDomain(name string) error
- func (b *InMemoryBackend) DeprecateWorkflowType(domain, name, version string) error
- func (b *InMemoryBackend) DescribeActivityType(domain, name, version string) (*ActivityType, error)
- func (b *InMemoryBackend) DescribeDomain(name string) (*Domain, error)
- func (b *InMemoryBackend) DescribeWorkflowExecution(domain, workflowID string) (*WorkflowExecution, error)
- func (b *InMemoryBackend) DescribeWorkflowType(domain, name, version string) (*WorkflowType, error)
- func (b *InMemoryBackend) EnqueueActivityTaskInternal(...)
- func (b *InMemoryBackend) EnqueueDecisionTaskInternal(domain, taskList, workflowID, runID string)
- func (b *InMemoryBackend) GetWorkflowExecutionHistory(domain, workflowID string, maxPageSize int, nextPageToken string, ...) ([]HistoryEvent, string)
- func (b *InMemoryBackend) ListActivityTypes(domain, registrationStatus string) ([]ActivityType, error)
- func (b *InMemoryBackend) ListClosedWorkflowExecutions(domain string, filter ExecutionFilter) []WorkflowExecution
- func (b *InMemoryBackend) ListDomains(registrationStatus string) ([]Domain, error)
- func (b *InMemoryBackend) ListOpenWorkflowExecutions(domain string, filter ExecutionFilter) []WorkflowExecution
- func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) ListWorkflowTypes(domain, registrationStatus string) ([]WorkflowType, error)
- func (b *InMemoryBackend) PollForActivityTask(domain, taskList string) *ActivityTask
- func (b *InMemoryBackend) PollForDecisionTask(domain, taskList string, maxPageSize int, nextPageToken string) *DecisionTask
- func (b *InMemoryBackend) RecordActivityTaskHeartbeat(taskToken string) (bool, error)
- func (b *InMemoryBackend) RegisterActivityType(domain, name, version, description string, defaults ActivityTypeDefaults) error
- func (b *InMemoryBackend) RegisterDomain(name, description, retention string) error
- func (b *InMemoryBackend) RegisterWorkflowType(domain, name, version, description string, defaults WorkflowTypeDefaults) error
- func (b *InMemoryBackend) RequestCancelWorkflowExecution(domain, workflowID, runID string) error
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) RespondActivityTaskCanceled(taskToken, details string) error
- func (b *InMemoryBackend) RespondActivityTaskCompleted(taskToken, result string) error
- func (b *InMemoryBackend) RespondActivityTaskFailed(taskToken, reason, details string) error
- func (b *InMemoryBackend) RespondDecisionTaskCompleted(taskToken, executionContext string, decisions []Decision) error
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) SignalWorkflowExecution(domain, workflowID, runID, signalName, input string) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) StartWorkflowExecution(input StartWorkflowExecutionInput) (*WorkflowExecution, error)
- func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error
- func (b *InMemoryBackend) TerminateWorkflowExecution(domain, workflowID, runID, reason, details, childPolicyOverride string) error
- func (b *InMemoryBackend) UndeprecateActivityType(domain, name, version string) error
- func (b *InMemoryBackend) UndeprecateDomain(name string) error
- func (b *InMemoryBackend) UndeprecateWorkflowType(domain, name, version string) error
- func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
- type Provider
- type RecordMarkerDecisionAttrs
- type RequestCancelActivityTaskDecisionAttrs
- type RequestCancelExternalWorkflowExecutionDecisionAttrs
- type ScheduleActivityTaskDecisionAttrs
- type SignalExternalWorkflowExecutionDecisionAttrs
- type StartChildWorkflowExecutionDecisionAttrs
- type StartTimerDecisionAttrs
- type StartWorkflowExecutionInput
- type StorageBackend
- type WorkflowExecution
- type WorkflowType
- type WorkflowTypeDefaults
- type WorkflowTypeRef
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when a resource is not found. ErrNotFound = awserr.New("UnknownResourceFault", awserr.ErrNotFound) // ErrAlreadyExists is returned when a resource already exists. ErrAlreadyExists = awserr.New("DomainAlreadyExistsFault", awserr.ErrAlreadyExists) // ErrDeprecated is returned when trying to re-register a deprecated domain. ErrDeprecated = errors.New("DomainDeprecatedFault") // ErrTypeAlreadyExists is returned when a workflow or activity type already exists. ErrTypeAlreadyExists = errors.New("TypeAlreadyExistsFault") // ErrTypeDeprecated is returned when a type is already deprecated. ErrTypeDeprecated = errors.New("TypeDeprecatedFault") // ErrTypeNotDeprecated is returned when deleting a type that has not been deprecated. ErrTypeNotDeprecated = errors.New("TypeNotDeprecatedFault") // ErrValidation is returned when a request parameter fails validation. ErrValidation = awserr.New("ValidationException", awserr.ErrInvalidParameter) // ErrTooManyTags is returned when tag limits are exceeded. ErrTooManyTags = awserr.New("TooManyTagsFault", awserr.ErrInvalidParameter) // ErrOperationNotPermitted is returned for disallowed operations. ErrOperationNotPermitted = awserr.New("OperationNotPermittedFault", awserr.ErrConflict) // ErrWorkflowAlreadyStarted is returned when a workflow is already open. ErrWorkflowAlreadyStarted = awserr.New("WorkflowExecutionAlreadyStartedFault", awserr.ErrAlreadyExists) )
var ErrNilAppContext = errors.New("swf: nil app context")
ErrNilAppContext is returned when Init is called with a nil AppContext.
var ( // ErrUnknownOperation is returned when the requested SWF operation is not supported. ErrUnknownOperation = errors.New("UnknownOperationException") )
Functions ¶
This section is empty.
Types ¶
type ActivityTask ¶
type ActivityTask struct {
TaskToken string `json:"taskToken"`
ActivityID string `json:"activityId"`
ActivityType ActivityTaskActivityType `json:"activityType"`
Input string `json:"input,omitempty"`
WorkflowID string `json:"workflowId"`
RunID string `json:"runId"`
StartedEventID int64 `json:"startedEventId"`
ScheduledEventID int64 `json:"scheduledEventId"`
}
ActivityTask represents a pending activity task returned by PollForActivityTask.
type ActivityTaskActivityType ¶
ActivityTaskActivityType is the activity type reference within an activity task.
type ActivityType ¶
type ActivityType struct {
Defaults ActivityTypeDefaults `json:"defaults"`
Description string `json:"description"`
Domain string `json:"domain"`
Name string `json:"name"`
Version string `json:"version"`
Status string `json:"status"`
CreationDate float64 `json:"creationDate"`
}
ActivityType represents an SWF activity type.
type ActivityTypeDefaults ¶
type ActivityTypeDefaults struct {
DefaultTaskList string `json:"defaultTaskList,omitempty"`
DefaultTaskPriority string `json:"defaultTaskPriority,omitempty"`
DefaultTaskHeartbeatTimeout string `json:"defaultTaskHeartbeatTimeout,omitempty"`
DefaultTaskScheduleToCloseTimeout string `json:"defaultTaskScheduleToCloseTimeout,omitempty"`
DefaultTaskScheduleToStartTimeout string `json:"defaultTaskScheduleToStartTimeout,omitempty"`
DefaultTaskStartToCloseTimeout string `json:"defaultTaskStartToCloseTimeout,omitempty"`
}
ActivityTypeDefaults holds the registered defaults for an activity type.
type CancelTimerDecisionAttrs ¶
type CancelTimerDecisionAttrs struct {
TimerID string
}
CancelTimerDecisionAttrs holds attributes for CancelTimer.
type CancelWorkflowExecutionDecisionAttrs ¶
type CancelWorkflowExecutionDecisionAttrs struct {
Details string
}
CancelWorkflowExecutionDecisionAttrs holds attributes for CancelWorkflowExecution.
type CompleteWorkflowExecutionDecisionAttrs ¶
type CompleteWorkflowExecutionDecisionAttrs struct {
Result string
}
CompleteWorkflowExecutionDecisionAttrs holds attributes for CompleteWorkflowExecution.
type ContinueAsNewWorkflowExecutionDecisionAttrs ¶ added in v1.2.0
type ContinueAsNewWorkflowExecutionDecisionAttrs struct {
Input string
ExecutionStartToCloseTimeout string
TaskList string
TaskStartToCloseTimeout string
TaskPriority string
ChildPolicy string
LambdaRole string
WorkflowTypeVersion string
TagList []string
}
ContinueAsNewWorkflowExecutionDecisionAttrs holds attributes for ContinueAsNewWorkflowExecution. All fields are optional overrides: an empty field falls back to the current execution's WorkflowType-registered defaults, exactly like StartWorkflowExecution.
type Decision ¶
type Decision struct {
CompleteWorkflowExecutionAttrs *CompleteWorkflowExecutionDecisionAttrs
FailWorkflowExecutionAttrs *FailWorkflowExecutionDecisionAttrs
CancelWorkflowExecutionAttrs *CancelWorkflowExecutionDecisionAttrs
ScheduleActivityTaskAttrs *ScheduleActivityTaskDecisionAttrs
RequestCancelActivityTaskAttrs *RequestCancelActivityTaskDecisionAttrs
StartTimerAttrs *StartTimerDecisionAttrs
CancelTimerAttrs *CancelTimerDecisionAttrs
RecordMarkerAttrs *RecordMarkerDecisionAttrs
ContinueAsNewWorkflowExecutionAttrs *ContinueAsNewWorkflowExecutionDecisionAttrs
StartChildWorkflowExecutionAttrs *StartChildWorkflowExecutionDecisionAttrs
SignalExternalWorkflowExecutionAttrs *SignalExternalWorkflowExecutionDecisionAttrs
RequestCancelExternalWorkflowExecutionAttrs *RequestCancelExternalWorkflowExecutionDecisionAttrs
DecisionType string
}
Decision represents a single decision returned by a decider.
type DecisionTask ¶
type DecisionTask struct {
TaskToken string `json:"taskToken"`
WorkflowID string `json:"workflowId"`
RunID string `json:"runId"`
NextPageToken string `json:"nextPageToken,omitempty"`
WorkflowTypeName string `json:"workflowTypeName,omitempty"`
WorkflowTypeVersion string `json:"workflowTypeVersion,omitempty"`
Events []HistoryEvent `json:"events"`
StartedEventID int64 `json:"startedEventId"`
PreviousStartedEventID int64 `json:"previousStartedEventId"`
}
DecisionTask represents a pending decision task returned by PollForDecisionTask.
type Domain ¶
type Domain struct {
Name string `json:"name"`
Description string `json:"description"`
Status string `json:"status"` // REGISTERED or DEPRECATED
Arn string `json:"arn,omitempty"`
WorkflowExecutionRetentionPeriodInDays string `json:"workflowExecutionRetentionPeriodInDays"`
}
Domain represents an SWF domain.
type ExecutionFilter ¶
type ExecutionFilter struct {
OldestDate *time.Time
LatestDate *time.Time
CloseOldestDate *time.Time
CloseLatestDate *time.Time
WorkflowID string
WorkflowTypeName string
WorkflowTypeVersion string
Tag string
CloseStatus string
}
ExecutionFilter holds optional filters for counting/listing executions.
type FailWorkflowExecutionDecisionAttrs ¶
FailWorkflowExecutionDecisionAttrs holds attributes for FailWorkflowExecution.
type Handler ¶
type Handler struct {
Backend StorageBackend
// contains filtered or unexported fields
}
Handler is the Echo HTTP handler for SWF operations.
func NewHandler ¶
func NewHandler(backend StorageBackend) *Handler
NewHandler creates a new SWF handler with a cached dispatch table.
func (*Handler) ChaosOperations ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this SWF instance handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts the SWF action from the X-Amz-Target header.
func (*Handler) ExtractResource ¶
ExtractResource extracts the domain name from the request body.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the list of supported SWF operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches SWF requests.
type HistoryEvent ¶
type HistoryEvent struct {
Attributes map[string]any `json:"-"`
EventType string `json:"eventType"`
EventID int64 `json:"eventId"`
Timestamp float64 `json:"eventTimestamp"`
}
HistoryEvent is a single event in a workflow execution's history. The Attributes map holds the event-type-specific payload which is serialised under the key "<eventType>EventAttributes" per the AWS SWF JSON protocol.
func (HistoryEvent) MarshalJSON ¶
func (e HistoryEvent) MarshalJSON() ([]byte, error)
MarshalJSON emits the event-type-specific attributes alongside the standard fields.
func (*HistoryEvent) UnmarshalJSON ¶
func (e *HistoryEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON restores a HistoryEvent from its JSON representation, capturing any unknown keys (the attributes block) into Attributes.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend is the in-memory store for SWF resources.
domains, workflows, activities, and executions are "clean" store.Table-backed collections (Phase 3.3 of the datalayer refactor): each value type already carries its own identity as real, wire-visible JSON fields (Domain/Name/Version or Domain/WorkflowID), so each is registered directly on registry -- see store_setup.go. workflows/activities/executions additionally carry a companion byDomain store.Index (workflowsByDomain/activitiesByDomain/executionsByDomain) replacing the linear full-table scan+filter the old flat maps needed for every domain-scoped List/Count op.
activeActivityTasks/activeDecisionTasks are "dirty" store.Table-backed collections: their key (taskToken) has no home on the value type, so each gained a TaskToken field tagged json:"-" purely for store.Table's keyFn (see the type docs in models.go) and is NOT registered on registry -- persistence.go instead round-trips them through an ephemeral DTO registry, exactly as the "dirty" tables in services/ses and services/codeartifact do.
history, activityQueues, decisionQueues, and tags are deliberately left as plain maps: history/activityQueues/decisionQueues are ORDER-SENSITIVE (event histories and FIFO task queues, where store.Index's swap-with-last removal would silently reorder pending entries), and tags's values (map[string]string) are not *T, which store.Table requires.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates a new InMemoryBackend.
func (*InMemoryBackend) AccountID ¶
func (b *InMemoryBackend) AccountID() string
AccountID returns the account ID for this backend.
func (*InMemoryBackend) AddActivityTypeInternal ¶
func (b *InMemoryBackend) AddActivityTypeInternal(domain, name, version, status string)
AddActivityTypeInternal seeds an activity type directly for testing.
func (*InMemoryBackend) AddWorkflowTypeInternal ¶
func (b *InMemoryBackend) AddWorkflowTypeInternal(domain, name, version, status string)
AddWorkflowTypeInternal seeds a workflow type directly for testing.
func (*InMemoryBackend) CountClosedWorkflowExecutions ¶
func (b *InMemoryBackend) CountClosedWorkflowExecutions(domain string, filter ExecutionFilter) int
CountClosedWorkflowExecutions counts non-RUNNING workflow executions in a domain, applying filters.
func (*InMemoryBackend) CountOpenWorkflowExecutions ¶
func (b *InMemoryBackend) CountOpenWorkflowExecutions(domain string, filter ExecutionFilter) int
CountOpenWorkflowExecutions counts RUNNING workflow executions in a domain, applying filters.
func (*InMemoryBackend) CountPendingActivityTasks ¶
func (b *InMemoryBackend) CountPendingActivityTasks(domain, taskList string) int
CountPendingActivityTasks returns the number of pending activity tasks for a task list.
func (*InMemoryBackend) CountPendingDecisionTasks ¶
func (b *InMemoryBackend) CountPendingDecisionTasks(domain, taskList string) int
CountPendingDecisionTasks returns the number of pending decision tasks for a task list.
func (*InMemoryBackend) DeleteActivityType ¶
func (b *InMemoryBackend) DeleteActivityType(domain, name, version string) error
DeleteActivityType permanently removes a deprecated activity type. Real AWS requires the type to be deprecated first (TypeNotDeprecatedFault otherwise); after deletion, new activities of that type can no longer be scheduled, but activities already started before the type was deleted continue to run.
func (*InMemoryBackend) DeleteWorkflowType ¶
func (b *InMemoryBackend) DeleteWorkflowType(domain, name, version string) error
DeleteWorkflowType permanently removes a deprecated workflow type. Real AWS requires the type to be deprecated first (TypeNotDeprecatedFault otherwise); after deletion, StartWorkflowExecution can no longer reference it, but executions already running under it are unaffected.
func (*InMemoryBackend) DeprecateActivityType ¶
func (b *InMemoryBackend) DeprecateActivityType(domain, name, version string) error
DeprecateActivityType marks an activity type as deprecated.
func (*InMemoryBackend) DeprecateDomain ¶
func (b *InMemoryBackend) DeprecateDomain(name string) error
DeprecateDomain marks a domain as deprecated. Per the real AWS doc comment on DeprecateDomain ("Deprecating a domain also deprecates all activity and workflow types registered in the domain. Executions that were started before the domain was deprecated continue to run."), this cascades DEPRECATED onto every REGISTERED workflow/activity type in the domain -- executions are deliberately left untouched (they keep running).
func (*InMemoryBackend) DeprecateWorkflowType ¶
func (b *InMemoryBackend) DeprecateWorkflowType(domain, name, version string) error
DeprecateWorkflowType marks a workflow type as deprecated.
func (*InMemoryBackend) DescribeActivityType ¶
func (b *InMemoryBackend) DescribeActivityType( domain, name, version string, ) (*ActivityType, error)
DescribeActivityType returns the details of an activity type.
func (*InMemoryBackend) DescribeDomain ¶
func (b *InMemoryBackend) DescribeDomain(name string) (*Domain, error)
DescribeDomain returns the details of a registered SWF domain.
func (*InMemoryBackend) DescribeWorkflowExecution ¶
func (b *InMemoryBackend) DescribeWorkflowExecution( domain, workflowID string, ) (*WorkflowExecution, error)
DescribeWorkflowExecution returns a workflow execution.
func (*InMemoryBackend) DescribeWorkflowType ¶
func (b *InMemoryBackend) DescribeWorkflowType( domain, name, version string, ) (*WorkflowType, error)
DescribeWorkflowType returns the details of a workflow type.
func (*InMemoryBackend) EnqueueActivityTaskInternal ¶
func (b *InMemoryBackend) EnqueueActivityTaskInternal( domain, taskList, activityID, activityName, activityVersion, input, workflowID, runID string, )
EnqueueActivityTaskInternal seeds an activity task in a task list for testing.
func (*InMemoryBackend) EnqueueDecisionTaskInternal ¶
func (b *InMemoryBackend) EnqueueDecisionTaskInternal(domain, taskList, workflowID, runID string)
EnqueueDecisionTaskInternal seeds a decision task in a task list for testing.
func (*InMemoryBackend) GetWorkflowExecutionHistory ¶
func (b *InMemoryBackend) GetWorkflowExecutionHistory( domain, workflowID string, maxPageSize int, nextPageToken string, reverseOrder bool, ) ([]HistoryEvent, string)
GetWorkflowExecutionHistory returns history events for a workflow execution, supporting pagination and reverse ordering.
func (*InMemoryBackend) ListActivityTypes ¶
func (b *InMemoryBackend) ListActivityTypes( domain, registrationStatus string, ) ([]ActivityType, error)
ListActivityTypes returns activity types for a domain, optionally filtered by registrationStatus.
func (*InMemoryBackend) ListClosedWorkflowExecutions ¶
func (b *InMemoryBackend) ListClosedWorkflowExecutions( domain string, filter ExecutionFilter, ) []WorkflowExecution
ListClosedWorkflowExecutions returns all closed executions in a domain matching the filter.
func (*InMemoryBackend) ListDomains ¶
func (b *InMemoryBackend) ListDomains(registrationStatus string) ([]Domain, error)
ListDomains returns all domains with the given registrationStatus. An empty status returns all domains.
func (*InMemoryBackend) ListOpenWorkflowExecutions ¶
func (b *InMemoryBackend) ListOpenWorkflowExecutions( domain string, filter ExecutionFilter, ) []WorkflowExecution
ListOpenWorkflowExecutions returns all running executions in a domain matching the filter.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
ListTagsForResource returns tags for a resource ARN. Returns an error if the ARN is not a valid SWF domain ARN or the domain does not exist.
func (*InMemoryBackend) ListWorkflowTypes ¶
func (b *InMemoryBackend) ListWorkflowTypes( domain, registrationStatus string, ) ([]WorkflowType, error)
ListWorkflowTypes returns workflow types for a domain, optionally filtered by registrationStatus.
func (*InMemoryBackend) PollForActivityTask ¶
func (b *InMemoryBackend) PollForActivityTask(domain, taskList string) *ActivityTask
PollForActivityTask returns the next available activity task for a task list, or nil if none.
func (*InMemoryBackend) PollForDecisionTask ¶
func (b *InMemoryBackend) PollForDecisionTask( domain, taskList string, maxPageSize int, nextPageToken string, ) *DecisionTask
PollForDecisionTask returns the next available decision task for a task list, or nil if none.
func (*InMemoryBackend) RecordActivityTaskHeartbeat ¶
func (b *InMemoryBackend) RecordActivityTaskHeartbeat(taskToken string) (bool, error)
RecordActivityTaskHeartbeat acknowledges a heartbeat for an activity task token. Returns true if cancel has been requested for the workflow; always false in this emulator.
func (*InMemoryBackend) RegisterActivityType ¶
func (b *InMemoryBackend) RegisterActivityType( domain, name, version, description string, defaults ActivityTypeDefaults, ) error
RegisterActivityType registers a new activity type with optional default settings.
func (*InMemoryBackend) RegisterDomain ¶
func (b *InMemoryBackend) RegisterDomain(name, description, retention string) error
RegisterDomain registers a new SWF domain with the given retention period. retention must be "0"-"90" or "NONE" (empty defaults to "NONE").
func (*InMemoryBackend) RegisterWorkflowType ¶
func (b *InMemoryBackend) RegisterWorkflowType( domain, name, version, description string, defaults WorkflowTypeDefaults, ) error
RegisterWorkflowType registers a new workflow type with optional default settings.
func (*InMemoryBackend) RequestCancelWorkflowExecution ¶
func (b *InMemoryBackend) RequestCancelWorkflowExecution(domain, workflowID, runID string) error
RequestCancelWorkflowExecution requests cancellation of a running execution. runID is optional; if provided, it must match.
func (*InMemoryBackend) RespondActivityTaskCanceled ¶
func (b *InMemoryBackend) RespondActivityTaskCanceled(taskToken, details string) error
RespondActivityTaskCanceled marks an activity task as canceled.
func (*InMemoryBackend) RespondActivityTaskCompleted ¶
func (b *InMemoryBackend) RespondActivityTaskCompleted(taskToken, result string) error
RespondActivityTaskCompleted marks an activity task as completed.
func (*InMemoryBackend) RespondActivityTaskFailed ¶
func (b *InMemoryBackend) RespondActivityTaskFailed(taskToken, reason, details string) error
RespondActivityTaskFailed marks an activity task as failed.
func (*InMemoryBackend) RespondDecisionTaskCompleted ¶
func (b *InMemoryBackend) RespondDecisionTaskCompleted( taskToken, executionContext string, decisions []Decision, ) error
RespondDecisionTaskCompleted processes a completed decision task and applies decisions.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.
func (*InMemoryBackend) SignalWorkflowExecution ¶
func (b *InMemoryBackend) SignalWorkflowExecution( domain, workflowID, runID, signalName, input string, ) error
SignalWorkflowExecution sends a signal to a workflow execution, recording it in history.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state to JSON. It implements persistence.Persistable.
func (*InMemoryBackend) StartWorkflowExecution ¶
func (b *InMemoryBackend) StartWorkflowExecution( input StartWorkflowExecutionInput, ) (*WorkflowExecution, error)
StartWorkflowExecution starts a new workflow execution. It validates that the referenced WorkflowType exists and is REGISTERED.
func (*InMemoryBackend) TagResource ¶
func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error
TagResource adds or updates tags on a resource. Validates ARN format, domain existence, tag count and key/value length limits.
func (*InMemoryBackend) TerminateWorkflowExecution ¶
func (b *InMemoryBackend) TerminateWorkflowExecution( domain, workflowID, runID, reason, details, childPolicyOverride string, ) error
TerminateWorkflowExecution terminates a running workflow execution. runID is optional; if provided, it must match. reason and details are stored in history. childPolicyOverride, if non-empty, is real SWF's per-call override of the child policy applied to this execution's open child executions -- it takes precedence over the policy stored on exec (set at StartWorkflowExecution time) for this call only, and never mutates that stored value. An empty override falls back to the stored policy, exactly as if the field had been omitted on the wire.
func (*InMemoryBackend) UndeprecateActivityType ¶
func (b *InMemoryBackend) UndeprecateActivityType(domain, name, version string) error
UndeprecateActivityType re-activates a deprecated activity type.
func (*InMemoryBackend) UndeprecateDomain ¶
func (b *InMemoryBackend) UndeprecateDomain(name string) error
UndeprecateDomain re-activates a deprecated domain.
func (*InMemoryBackend) UndeprecateWorkflowType ¶
func (b *InMemoryBackend) UndeprecateWorkflowType(domain, name, version string) error
UndeprecateWorkflowType re-activates a deprecated workflow type.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
UntagResource removes tags from a resource.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for SWF.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the SWF service backend and handler.
type RecordMarkerDecisionAttrs ¶
RecordMarkerDecisionAttrs holds attributes for RecordMarker.
type RequestCancelActivityTaskDecisionAttrs ¶
type RequestCancelActivityTaskDecisionAttrs struct {
ActivityID string
}
RequestCancelActivityTaskDecisionAttrs holds attributes for RequestCancelActivityTask.
type RequestCancelExternalWorkflowExecutionDecisionAttrs ¶ added in v1.2.0
type RequestCancelExternalWorkflowExecutionDecisionAttrs struct {
WorkflowID string
RunID string
Control string
}
RequestCancelExternalWorkflowExecutionDecisionAttrs holds attributes for RequestCancelExternalWorkflowExecution.
type ScheduleActivityTaskDecisionAttrs ¶
type ScheduleActivityTaskDecisionAttrs struct {
ActivityType ActivityTaskActivityType
ActivityID string
Input string
TaskList string
ScheduleToCloseTimeout string
ScheduleToStartTimeout string
StartToCloseTimeout string
HeartbeatTimeout string
}
ScheduleActivityTaskDecisionAttrs holds attributes for ScheduleActivityTask.
type SignalExternalWorkflowExecutionDecisionAttrs ¶ added in v1.2.0
type SignalExternalWorkflowExecutionDecisionAttrs struct {
WorkflowID string
RunID string
SignalName string
Input string
Control string
}
SignalExternalWorkflowExecutionDecisionAttrs holds attributes for SignalExternalWorkflowExecution.
type StartChildWorkflowExecutionDecisionAttrs ¶ added in v1.2.0
type StartChildWorkflowExecutionDecisionAttrs struct {
WorkflowID string
WorkflowType WorkflowTypeRef
Control string
Input string
ExecutionStartToCloseTimeout string
TaskList string
TaskPriority string
TaskStartToCloseTimeout string
ChildPolicy string
LambdaRole string
TagList []string
}
StartChildWorkflowExecutionDecisionAttrs holds attributes for StartChildWorkflowExecution.
type StartTimerDecisionAttrs ¶
StartTimerDecisionAttrs holds attributes for StartTimer.
type StartWorkflowExecutionInput ¶
type StartWorkflowExecutionInput struct {
Input string
WorkflowID string
RunID string
WorkflowTypeName string
WorkflowTypeVersion string
TaskList string
Domain string
ChildPolicy string
LambdaRole string
ExecutionStartToCloseTimeout string
TaskStartToCloseTimeout string
TaskPriority string
TagList []string
}
StartWorkflowExecutionInput holds all parameters for starting a workflow execution.
type StorageBackend ¶
type StorageBackend interface {
// Domain lifecycle
RegisterDomain(name, description, retention string) error
DescribeDomain(name string) (*Domain, error)
ListDomains(registrationStatus string) ([]Domain, error)
DeprecateDomain(name string) error
UndeprecateDomain(name string) error
// WorkflowType lifecycle
RegisterWorkflowType(domain, name, version, description string, defaults WorkflowTypeDefaults) error
ListWorkflowTypes(domain, registrationStatus string) ([]WorkflowType, error)
DescribeWorkflowType(domain, name, version string) (*WorkflowType, error)
DeprecateWorkflowType(domain, name, version string) error
UndeprecateWorkflowType(domain, name, version string) error
DeleteWorkflowType(domain, name, version string) error
// ActivityType lifecycle
RegisterActivityType(domain, name, version, description string, defaults ActivityTypeDefaults) error
ListActivityTypes(domain, registrationStatus string) ([]ActivityType, error)
DescribeActivityType(domain, name, version string) (*ActivityType, error)
DeprecateActivityType(domain, name, version string) error
UndeprecateActivityType(domain, name, version string) error
DeleteActivityType(domain, name, version string) error
// Execution counts
CountOpenWorkflowExecutions(domain string, filter ExecutionFilter) int
CountClosedWorkflowExecutions(domain string, filter ExecutionFilter) int
CountPendingActivityTasks(domain, taskList string) int
CountPendingDecisionTasks(domain, taskList string) int
// Execution lifecycle
StartWorkflowExecution(input StartWorkflowExecutionInput) (*WorkflowExecution, error)
TerminateWorkflowExecution(domain, workflowID, runID, reason, details, childPolicyOverride string) error
DescribeWorkflowExecution(domain, workflowID string) (*WorkflowExecution, error)
GetWorkflowExecutionHistory(
domain, workflowID string,
maxPageSize int,
nextPageToken string,
reverseOrder bool,
) ([]HistoryEvent, string)
ListOpenWorkflowExecutions(domain string, filter ExecutionFilter) []WorkflowExecution
ListClosedWorkflowExecutions(domain string, filter ExecutionFilter) []WorkflowExecution
RequestCancelWorkflowExecution(domain, workflowID, runID string) error
SignalWorkflowExecution(domain, workflowID, runID, signalName, input string) error
// Task polling and responses
PollForActivityTask(domain, taskList string) *ActivityTask
PollForDecisionTask(domain, taskList string, maxPageSize int, nextPageToken string) *DecisionTask
RecordActivityTaskHeartbeat(taskToken string) (bool, error)
RespondActivityTaskCanceled(taskToken, details string) error
RespondActivityTaskCompleted(taskToken, result string) error
RespondActivityTaskFailed(taskToken, reason, details string) error
RespondDecisionTaskCompleted(taskToken, executionContext string, decisions []Decision) error
// Resource tagging
ListTagsForResource(resourceARN string) (map[string]string, error)
TagResource(resourceARN string, tags map[string]string) error
UntagResource(resourceARN string, tagKeys []string) error
// Backend lifecycle
Reset()
Snapshot(ctx context.Context) []byte
Restore(ctx context.Context, data []byte) error
}
StorageBackend defines the interface for SWF backend implementations. All mutating methods must be safe for concurrent use.
type WorkflowExecution ¶
type WorkflowExecution struct {
ChildPolicy string `json:"childPolicy,omitempty"`
TaskPriority string `json:"taskPriority,omitempty"`
RunID string `json:"runID"`
TaskList string `json:"taskList,omitempty"`
CloseStatus string `json:"closeStatus,omitempty"`
LatestExecutionContext string `json:"latestExecutionContext,omitempty"`
TaskStartToCloseTimeout string `json:"taskStartToCloseTimeout,omitempty"`
WorkflowTypeName string `json:"workflowTypeName,omitempty"`
WorkflowID string `json:"workflowID"`
Input string `json:"input,omitempty"`
LambdaRole string `json:"lambdaRole,omitempty"`
Status string `json:"status"`
ParentRunID string `json:"parentRunID,omitempty"`
Domain string `json:"domain"`
ExecutionStartToCloseTimeout string `json:"executionStartToCloseTimeout,omitempty"`
ParentWorkflowID string `json:"parentWorkflowID,omitempty"`
WorkflowTypeVersion string `json:"workflowTypeVersion,omitempty"`
TagList []string `json:"tagList,omitempty"`
OpenTimerIDs []string `json:"openTimerIDs,omitempty"`
StartTimestamp float64 `json:"startTimestamp"`
CloseTimestamp float64 `json:"closeTimestamp,omitempty"`
ParentInitiatedEventID int64 `json:"parentInitiatedEventID,omitempty"`
ParentStartedEventID int64 `json:"parentStartedEventID,omitempty"`
CancelRequested bool `json:"cancelRequested,omitempty"`
}
WorkflowExecution represents an SWF workflow execution.
type WorkflowType ¶
type WorkflowType struct {
Defaults WorkflowTypeDefaults `json:"defaults"`
Description string `json:"description"`
Domain string `json:"domain"`
Name string `json:"name"`
Version string `json:"version"`
Status string `json:"status"`
CreationDate float64 `json:"creationDate"`
}
WorkflowType represents an SWF workflow type.
type WorkflowTypeDefaults ¶
type WorkflowTypeDefaults struct {
DefaultTaskList string `json:"defaultTaskList,omitempty"`
DefaultTaskPriority string `json:"defaultTaskPriority,omitempty"`
DefaultTaskStartToCloseTimeout string `json:"defaultTaskStartToCloseTimeout,omitempty"`
DefaultExecutionStartToCloseTimeout string `json:"defaultExecutionStartToCloseTimeout,omitempty"`
DefaultChildPolicy string `json:"defaultChildPolicy,omitempty"`
DefaultLambdaRole string `json:"defaultLambdaRole,omitempty"`
}
WorkflowTypeDefaults holds the registered defaults for a workflow type.
type WorkflowTypeRef ¶ added in v1.2.0
WorkflowTypeRef identifies a workflow type by name/version within a decision's attributes (mirrors the wire-level workflowType field shape).
Source Files
¶
- activity_tasks.go
- activity_types.go
- decision_orchestration.go
- decision_tasks.go
- domains.go
- errors.go
- handler.go
- handler_activity_tasks.go
- handler_activity_types.go
- handler_decision_tasks.go
- handler_domains.go
- handler_history.go
- handler_signals.go
- handler_tags.go
- handler_workflow_executions.go
- handler_workflow_types.go
- history.go
- interfaces.go
- models.go
- persistence.go
- provider.go
- signals.go
- store.go
- store_setup.go
- tags.go
- workflow_executions.go
- workflow_types.go