Skip to main content

fakecloud_swf/
lib.rs

1//! Amazon SWF (`swf`) awsJson1_0 service for fakecloud.
2//!
3//! The full 39-operation Amazon Simple Workflow Service Smithy model: domains
4//! (`RegisterDomain` / `DeprecateDomain` / `UndeprecateDomain` / `DescribeDomain`
5//! / `ListDomains`, with `REGISTERED` / `DEPRECATED` status), versioned activity
6//! and workflow types (`Register*` / `Deprecate*` / `Undeprecate*` / `Delete*` /
7//! `Describe*` / `List*Types`, configuration echoed back verbatim), workflow
8//! executions (`StartWorkflowExecution` mints a `runId` and opens the execution;
9//! `DescribeWorkflowExecution`, `GetWorkflowExecutionHistory`,
10//! `List`/`CountOpen`/`ClosedWorkflowExecutions`, `SignalWorkflowExecution`,
11//! `RequestCancelWorkflowExecution`, `TerminateWorkflowExecution`), the pending
12//! task counts (`CountPendingActivityTasks` / `CountPendingDecisionTasks`), and
13//! ARN-keyed domain tagging (`TagResource` / `UntagResource` /
14//! `ListTagsForResource`).
15//!
16//! Requests carry `X-Amz-Target: SimpleWorkflowService.<Operation>`; dispatch
17//! keys off `req.action`. Every operation runs model-driven input validation
18//! first (required / length / range / enum), then real, account-partitioned,
19//! persisted behavior.
20//!
21//! The decider/worker state machine is real and in-memory:
22//! `StartWorkflowExecution` seeds a `WorkflowExecutionStarted` event followed by
23//! a `DecisionTaskScheduled`; `PollForDecisionTask` hands back the next pending
24//! decision task with the full history (appending `DecisionTaskStarted`);
25//! `RespondDecisionTaskCompleted` applies each decision (`ScheduleActivityTask`,
26//! `CompleteWorkflowExecution`, `FailWorkflowExecution`, `StartTimer`,
27//! `RecordMarker`, ...) and appends the matching history events;
28//! `PollForActivityTask` hands out the scheduled activity task (appending
29//! `ActivityTaskStarted`); `RespondActivityTask{Completed,Failed,Canceled}`
30//! records the outcome and schedules a fresh decision task so the next
31//! `PollForDecisionTask` observes the result; a `CompleteWorkflowExecution`
32//! decision closes the execution, which then appears in the closed-execution
33//! listings and counts. Task tokens index back to their owning execution so a
34//! `Respond*` / `RecordActivityTaskHeartbeat` resolves in O(1).
35//!
36//! Honest timer gap: SWF's real service fires timers, task-timeouts, and
37//! execution-timeouts on wall-clock deadlines from a managed scheduler.
38//! fakecloud records `TimerStarted` / `StartTimer` decisions and the
39//! `*StartToCloseTimeout` configuration faithfully, but does not run a
40//! background clock that autonomously fires `TimerFired` / `*TimedOut` events;
41//! those transitions are driven by explicit decider/worker calls. Every other
42//! part of the state machine -- history, task dispatch, decision application,
43//! execution close-out, counts, tags, and persistence -- is real.
44
45pub mod persistence;
46pub mod service;
47pub mod shared;
48pub mod state;
49mod validate;
50
51pub use service::{SwfService, SWF_ACTIONS};
52pub use state::{SharedSwfState, SwfData, SwfSnapshot, SWF_SNAPSHOT_SCHEMA_VERSION};