Skip to content

Commit e0cd9d9

Browse files
committed
Move shared constraints to ADR appendix
1 parent 2edad67 commit e0cd9d9

1 file changed

Lines changed: 49 additions & 49 deletions

File tree

docs/adr/005-filesystem-serdes.md

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -25,55 +25,6 @@ There are a few Java-specific constraints:
2525
- Filesystem-backed storage is optional and storage-specific. It should not add filesystem-oriented public surface area to the core SDK artifact.
2626
- Filesystem persistence is not automatically durable. Lambda `/tmp` is not valid for replay across environments. Mounted S3 Files may have delayed synchronization and can lose recent writes if the runtime crashes before the mount flushes. EFS or an explicitly accepted S3 Files durability tradeoff should be required for production use.
2727

28-
## Shared Design Constraints
29-
30-
These constraints apply to both approaches below.
31-
32-
### Stable payload identity
33-
34-
Both approaches need a stable payload identity that can be used to address external storage. The identity must include the durable execution ARN, operation identity, payload kind, and enough operation metadata to distinguish result, input, callback, wait-for-condition state, and exception payloads.
35-
36-
`entityId` is the primary stable key for external storage. It must be unique within a durable execution and include the payload kind so one operation can safely store multiple values:
37-
38-
| Payload | Example entity ID |
39-
|---------|-------------------|
40-
| Root input | `execution/<execution-operation-id>/input` |
41-
| Root output | `execution/<execution-operation-id>/output` |
42-
| Root exception | `execution/<execution-operation-id>/exception` |
43-
| Step result | `operation/<operation-id>/result` |
44-
| Step exception | `operation/<operation-id>/exception` |
45-
| Invoke payload | `operation/<operation-id>/invoke-payload` |
46-
| Invoke result | `operation/<operation-id>/result` |
47-
| Callback result | `operation/<operation-id>/result` |
48-
| Child context result | `operation/<operation-id>/result` |
49-
| Map result | `operation/<operation-id>/result` |
50-
| WaitForCondition state | `operation/<operation-id>/state` |
51-
52-
Do not include the checkpoint token or raw user payload in the context.
53-
54-
### Extra package pattern
55-
56-
Payload offloading implementations should live outside the core SDK artifact when they target a specific storage mechanism.
57-
58-
Use the `aws-durable-execution-sdk-java-extra-xxx` artifact pattern. The filesystem payload package name depends on which approach is chosen; the repository should not publish both a filesystem SerDes package and a filesystem offloader package for the same feature.
59-
60-
| Feature | Artifact ID | Java package |
61-
|---------|-------------|--------------|
62-
| Filesystem payload storage, Approach A | `aws-durable-execution-sdk-java-extra-filesystem-serdes` | `software.amazon.lambda.durable.extra.filesystem` |
63-
| Filesystem payload storage, Approach B | `aws-durable-execution-sdk-java-extra-filesystem-offloader` | `software.amazon.lambda.durable.extra.filesystem` |
64-
| Event deserialization helpers | `aws-durable-execution-sdk-java-extra-event-deserialization` | `software.amazon.lambda.durable.extra.eventdeserialization` |
65-
| Virtual thread executor helpers | `aws-durable-execution-sdk-java-extra-virtual-thread-pool` | `software.amazon.lambda.durable.extra.virtualthreads` |
66-
67-
Extra modules should be independently documented, tested, and versioned with the repository release. They may depend on the core SDK and normal support libraries, but the core SDK should expose stable extension points without knowing about any specific extra package. For filesystem payload storage, create exactly one extra module after choosing Approach A or Approach B.
68-
69-
### Protocol SerDes boundary
70-
71-
Do not make `DurableInputOutputSerDes` customizable as part of this ADR. It serializes the Lambda Durable Functions backend protocol envelope, not user payloads. Routing that envelope through external payload storage would risk storing checkpoint tokens or protocol data externally and would require the backend to understand file pointers.
72-
73-
User input and output payloads should still use the configured user payload mechanism when they are extracted from or written to the execution operation. The internal `DurableExecutionInput` and `DurableExecutionOutput` envelope remains handled by `DurableInputOutputSerDes`.
74-
75-
If protocol customization is needed later, introduce a separate `ProtocolSerDes` configuration surface with a clear warning that it must produce the exact backend wire format. Do not reuse the user payload `SerDes` for that purpose.
76-
7728
## Approach A: Reuse SerDes for Offload
7829

7930
### Summary
@@ -532,3 +483,52 @@ Deferred:
532483
- A fully async Java SerDes or payload pipeline contract.
533484
- A separate, explicitly dangerous protocol-envelope customization API.
534485
- File cleanup, retention policies, and lifecycle management for offloaded payloads.
486+
487+
## Shared Design Constraints
488+
489+
These constraints apply to both approaches above.
490+
491+
### Stable payload identity
492+
493+
Both approaches need a stable payload identity that can be used to address external storage. The identity must include the durable execution ARN, operation identity, payload kind, and enough operation metadata to distinguish result, input, callback, wait-for-condition state, and exception payloads.
494+
495+
`entityId` is the primary stable key for external storage. It must be unique within a durable execution and include the payload kind so one operation can safely store multiple values:
496+
497+
| Payload | Example entity ID |
498+
|---------|-------------------|
499+
| Root input | `execution/<execution-operation-id>/input` |
500+
| Root output | `execution/<execution-operation-id>/output` |
501+
| Root exception | `execution/<execution-operation-id>/exception` |
502+
| Step result | `operation/<operation-id>/result` |
503+
| Step exception | `operation/<operation-id>/exception` |
504+
| Invoke payload | `operation/<operation-id>/invoke-payload` |
505+
| Invoke result | `operation/<operation-id>/result` |
506+
| Callback result | `operation/<operation-id>/result` |
507+
| Child context result | `operation/<operation-id>/result` |
508+
| Map result | `operation/<operation-id>/result` |
509+
| WaitForCondition state | `operation/<operation-id>/state` |
510+
511+
Do not include the checkpoint token or raw user payload in the context.
512+
513+
### Extra package pattern
514+
515+
Payload offloading implementations should live outside the core SDK artifact when they target a specific storage mechanism.
516+
517+
Use the `aws-durable-execution-sdk-java-extra-xxx` artifact pattern. The filesystem payload package name depends on which approach is chosen; the repository should not publish both a filesystem SerDes package and a filesystem offloader package for the same feature.
518+
519+
| Feature | Artifact ID | Java package |
520+
|---------|-------------|--------------|
521+
| Filesystem payload storage, Approach A | `aws-durable-execution-sdk-java-extra-filesystem-serdes` | `software.amazon.lambda.durable.extra.filesystem` |
522+
| Filesystem payload storage, Approach B | `aws-durable-execution-sdk-java-extra-filesystem-offloader` | `software.amazon.lambda.durable.extra.filesystem` |
523+
| Event deserialization helpers | `aws-durable-execution-sdk-java-extra-event-deserialization` | `software.amazon.lambda.durable.extra.eventdeserialization` |
524+
| Virtual thread executor helpers | `aws-durable-execution-sdk-java-extra-virtual-thread-pool` | `software.amazon.lambda.durable.extra.virtualthreads` |
525+
526+
Extra modules should be independently documented, tested, and versioned with the repository release. They may depend on the core SDK and normal support libraries, but the core SDK should expose stable extension points without knowing about any specific extra package. For filesystem payload storage, create exactly one extra module after choosing Approach A or Approach B.
527+
528+
### Protocol SerDes boundary
529+
530+
Do not make `DurableInputOutputSerDes` customizable as part of this ADR. It serializes the Lambda Durable Functions backend protocol envelope, not user payloads. Routing that envelope through external payload storage would risk storing checkpoint tokens or protocol data externally and would require the backend to understand file pointers.
531+
532+
User input and output payloads should still use the configured user payload mechanism when they are extracted from or written to the execution operation. The internal `DurableExecutionInput` and `DurableExecutionOutput` envelope remains handled by `DurableInputOutputSerDes`.
533+
534+
If protocol customization is needed later, introduce a separate `ProtocolSerDes` configuration surface with a clear warning that it must produce the exact backend wire format. Do not reuse the user payload `SerDes` for that purpose.

0 commit comments

Comments
 (0)