swf

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 25 Imported by: 0

README

SWF

Parity grade: A · SDK aws-sdk-go-v2/service/swf@v1.33.14 · last audited 2026-07-13 (d9aee9cb)

Coverage

Metric Value
Operations audited 39 (37 ok, 2 partial)
Feature families 1 (1 ok)
Known gaps 4
Deferred items 1
Resource leaks clean
Known gaps
  • ContinueAsNewWorkflowExecution decision closes the execution as CONTINUED_AS_NEW but never starts the new run (no fresh WorkflowExecution/RunID, no re-seeded decision task) -- deciders that rely on continue-as-new see the workflow simply end. Bigger feature, out of scope for a bug-fix pass. (bd: TODO -- file follow-up)
  • StartChildWorkflowExecution/SignalExternalWorkflowExecution/RequestCancelExternalWorkflowExecution decisions record an *Initiated history event but never actually start/signal/cancel the target execution, and their wire-level attrs (workflowId, control, input, etc.) still are not parsed into the Decision struct -- only Started/TimerStarted/CancelTimer/RecordMarker/RequestCancelActivityTask attrs were wired this pass. Cross-execution orchestration is a bigger feature. (bd: TODO -- file follow-up)
  • activityQueues/decisionQueues (FIFO pending-task lists) are intentionally NOT part of backendSnapshot (pre-existing, documented design choice in persistence.go/backend.go -- order-sensitive plain maps). A restart loses in-flight pending tasks that haven't been polled yet, while their corresponding history events and active-task records DO survive. Not fixed this pass (would require reworking backendSnapshot's shape); flagged for awareness. (bd: TODO -- file follow-up)
  • openTimers/openChildWorkflowExecutions/openLambdaFunctions in DescribeWorkflowExecution's openCounts are hardcoded to 0 -- consistent with the timer/child-workflow gaps above, not independently fixed.
Deferred
  • DescribeWorkflowExecution's openCounts.openLambdaFunctions (always 0 -- SWF Lambda task support is out of scope for a JSON-wire-shape/state-mutation audit)

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
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)
)
View Source
var ErrNilAppContext = errors.New("swf: nil app context")

ErrNilAppContext is returned when Init is called with a nil AppContext.

View Source
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

type ActivityTaskActivityType struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

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 Decision

type Decision struct {
	CompleteWorkflowExecutionAttrs *CompleteWorkflowExecutionDecisionAttrs
	FailWorkflowExecutionAttrs     *FailWorkflowExecutionDecisionAttrs
	CancelWorkflowExecutionAttrs   *CancelWorkflowExecutionDecisionAttrs
	ScheduleActivityTaskAttrs      *ScheduleActivityTaskDecisionAttrs
	RequestCancelActivityTaskAttrs *RequestCancelActivityTaskDecisionAttrs
	StartTimerAttrs                *StartTimerDecisionAttrs
	CancelTimerAttrs               *CancelTimerDecisionAttrs
	RecordMarkerAttrs              *RecordMarkerDecisionAttrs
	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

type FailWorkflowExecutionDecisionAttrs struct {
	Reason  string
	Details string
}

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

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this SWF instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation extracts the SWF action from the X-Amz-Target header.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts the domain name from the request body.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

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

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all backend state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches SWF requests.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

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.

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) Reset

func (b *InMemoryBackend) Reset()

Reset clears all backend state.

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 string,
) error

TerminateWorkflowExecution terminates a running workflow execution. runID is optional; if provided, it must match. reason and details are stored in history.

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

Init initializes the SWF service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type RecordMarkerDecisionAttrs

type RecordMarkerDecisionAttrs struct {
	MarkerName string
	Details    string
}

RecordMarkerDecisionAttrs holds attributes for RecordMarker.

type RequestCancelActivityTaskDecisionAttrs

type RequestCancelActivityTaskDecisionAttrs struct {
	ActivityID string
}

RequestCancelActivityTaskDecisionAttrs holds attributes for RequestCancelActivityTask.

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 StartTimerDecisionAttrs

type StartTimerDecisionAttrs struct {
	TimerID            string
	StartToFireTimeout string
}

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 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 {
	WorkflowTypeVersion          string   `json:"workflowTypeVersion,omitempty"`
	LambdaRole                   string   `json:"lambdaRole,omitempty"`
	RunID                        string   `json:"runID"`
	TaskList                     string   `json:"taskList,omitempty"`
	CloseStatus                  string   `json:"closeStatus,omitempty"`
	LatestExecutionContext       string   `json:"latestExecutionContext,omitempty"`
	TaskPriority                 string   `json:"taskPriority,omitempty"`
	WorkflowTypeName             string   `json:"workflowTypeName,omitempty"`
	WorkflowID                   string   `json:"workflowID"`
	Input                        string   `json:"input,omitempty"`
	Status                       string   `json:"status"`
	TaskStartToCloseTimeout      string   `json:"taskStartToCloseTimeout,omitempty"`
	ChildPolicy                  string   `json:"childPolicy,omitempty"`
	Domain                       string   `json:"domain"`
	ExecutionStartToCloseTimeout string   `json:"executionStartToCloseTimeout,omitempty"`
	TagList                      []string `json:"tagList,omitempty"`
	CloseTimestamp               float64  `json:"closeTimestamp,omitempty"`
	StartTimestamp               float64  `json:"startTimestamp"`
	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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL