-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Describe the solution you'd like
In short
-
Support the
patched(patchId, memoized): booleananddeprecatePatch(patchId, memoized): booleanAPIs in all SDKs -
Keep backward compatibility on existing APIs in each SDK, but deprecate those APIs
- The objective is to encourage users to move to the uniformized, simpler and less confusing APIs.
- Documentation on deprecated APIs should clearly indicate how existing calls may safely get converted.
-
In Core-based SDKs, delegate handling of the
patchedlogic to Core
Some details
-
The
memoizedflag needs to be stored in the Marker command, as part of the Workflow history. -
Inconsistent usage of the
memoizedflag should result in a Non-Determinism Error. -
Core SDK will implement this first, using the TS SDK as reference for the non-memoized bahavior, and Python/.Net for the memoized behavior. Java and Go will then mirror Core's implementation.
Existing APIs
All SDKs already provide some form of Workflow command to record versioning markers into Workflow history, but those APIs are inconsistent across the board:
-
Go, Java and PHP have
GetVersion, which associates a textual identifier and a numeric value, leaving to the user the responsibility of using these appropriately.GetVersionchecks are memoized, meaning that callingGetVersionwith a same textual identifier multiple time in the lifetime of a single Workflow Execution will always return the same numeric value as was first returned. -
Python, .NET and Ruby have the
patched()anddeprecate_patch()functions, which only takes a textual identifier, and return boolean value indicating either the new code should be executed or not. The return value is memoized. -
TypeScript also have
patched()anddeprecatePatch()functions, but those are non-memoized.
Per-SDK Tickets
- Go - Add
Patched()andDeprecatePatch()APIs sdk-go#1796 - Java - Add
patched()anddeprecatePatch()APIs sdk-java#2393 - Core - [Feature Request] Move more of the
patched()logic to Core rather than langs sdk-core#869 - TypeScript - [Feature Request] Add memoization support to the
patched()API sdk-typescript#1616 - Python - [Feature Request] Add explicit memoization support to the
patched()API sdk-python#754 - .NET - [Feature Request] Add explicit memoization support to the
Patched()API sdk-dotnet#398 - Ruby - [Feature Request] Add explicit memoization support to the
patched()API sdk-ruby#209 - PHP - Add
Patched()andDeprecatePatch()APIs sdk-php#558 - Temporal CLI - N/A