Skip to main content

Crate fakecloud_swf

Crate fakecloud_swf 

Source
Expand description

Amazon SWF (swf) awsJson1_0 service for fakecloud.

The full 39-operation Amazon Simple Workflow Service Smithy model: domains (RegisterDomain / DeprecateDomain / UndeprecateDomain / DescribeDomain / ListDomains, with REGISTERED / DEPRECATED status), versioned activity and workflow types (Register* / Deprecate* / Undeprecate* / Delete* / Describe* / List*Types, configuration echoed back verbatim), workflow executions (StartWorkflowExecution mints a runId and opens the execution; DescribeWorkflowExecution, GetWorkflowExecutionHistory, List/CountOpen/ClosedWorkflowExecutions, SignalWorkflowExecution, RequestCancelWorkflowExecution, TerminateWorkflowExecution), the pending task counts (CountPendingActivityTasks / CountPendingDecisionTasks), and ARN-keyed domain tagging (TagResource / UntagResource / ListTagsForResource).

Requests carry X-Amz-Target: SimpleWorkflowService.<Operation>; dispatch keys off req.action. Every operation runs model-driven input validation first (required / length / range / enum), then real, account-partitioned, persisted behavior.

The decider/worker state machine is real and in-memory: StartWorkflowExecution seeds a WorkflowExecutionStarted event followed by a DecisionTaskScheduled; PollForDecisionTask hands back the next pending decision task with the full history (appending DecisionTaskStarted); RespondDecisionTaskCompleted applies each decision (ScheduleActivityTask, CompleteWorkflowExecution, FailWorkflowExecution, StartTimer, RecordMarker, …) and appends the matching history events; PollForActivityTask hands out the scheduled activity task (appending ActivityTaskStarted); RespondActivityTask{Completed,Failed,Canceled} records the outcome and schedules a fresh decision task so the next PollForDecisionTask observes the result; a CompleteWorkflowExecution decision closes the execution, which then appears in the closed-execution listings and counts. Task tokens index back to their owning execution so a Respond* / RecordActivityTaskHeartbeat resolves in O(1).

Honest timer gap: SWF’s real service fires timers, task-timeouts, and execution-timeouts on wall-clock deadlines from a managed scheduler. fakecloud records TimerStarted / StartTimer decisions and the *StartToCloseTimeout configuration faithfully, but does not run a background clock that autonomously fires TimerFired / *TimedOut events; those transitions are driven by explicit decider/worker calls. Every other part of the state machine – history, task dispatch, decision application, execution close-out, counts, tags, and persistence – is real.

Re-exports§

pub use service::SwfService;
pub use service::SWF_ACTIONS;
pub use state::SharedSwfState;
pub use state::SwfData;
pub use state::SwfSnapshot;
pub use state::SWF_SNAPSHOT_SCHEMA_VERSION;

Modules§

persistence
Snapshot save/load for Amazon SWF state.
service
Amazon SWF awsJson1_0 dispatch + operation handlers.
shared
Primitives shared across the Amazon SWF handlers: ARN synthesis, run-id minting, timestamps, and the type/token key derivation. Kept in one place so the register / describe / poll paths cannot diverge on wire format.
state
Account-partitioned, serializable state for Amazon SWF (swf).