Repository navigation
Add transfer type converters #3073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
VegetarianOrc
wants to merge
26
commits into
main
Choose a base branch
from
amazzeo/transfer-type-converters
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,919
−254
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
583962b
WIP Transfer type converters
VegetarianOrc 3b2bbcf
Handle missing transfer result types
VegetarianOrc 1ff8771
Test transfer type converters across SDK paths
VegetarianOrc f50ffdd
Add transfer type support to workflow streams
VegetarianOrc 3cea60a
Merge branch 'main' into amazzeo/transfer-type-converters
VegetarianOrc 1c5fe58
Merge branch 'main' into amazzeo/transfer-type-converters
VegetarianOrc 452f46c
Use transfer-type converter internally
VegetarianOrc 6fec25d
Merge branch 'main' into amazzeo/transfer-type-converters
VegetarianOrc 37411ad
Merge branch 'main' into amazzeo/transfer-type-converters
VegetarianOrc 14e91b5
Remove transfer-type converters from workflow streams
VegetarianOrc 4849ec0
Consolidate client data converter creation into factory
VegetarianOrc 8be2665
Separate configured and internal client converters
VegetarianOrc 030d5eb
Merge branch 'main' into amazzeo/transfer-type-converters
VegetarianOrc 58bd31b
Validate transfer converter results during argument decoding
VegetarianOrc 0b82638
Expose transfer-aware conversion in clients and failures
VegetarianOrc 49b483b
Document transfer type converters in changelog
VegetarianOrc 96eb2de
Test transfer-aware converter in activity context
VegetarianOrc aa6daac
Address transfer type converter review findings
VegetarianOrc 184a740
Merge branch 'main' into amazzeo/transfer-type-converters
VegetarianOrc 698633c
Pass explicit dependencies to client invokers
VegetarianOrc 99682ec
Remove unrelated Worker constructor cleanup
VegetarianOrc b8325fc
Separate workflow client options from converter plumbing
VegetarianOrc 14fbbe9
Merge main into transfer type converters
VegetarianOrc c045d35
Merge branch 'main' into amazzeo/transfer-type-converters
VegetarianOrc 08d5729
Preserve test client options in cloud configuration
VegetarianOrc 19a74be
Merge branch 'main' into amazzeo/transfer-type-converters
VegetarianOrc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
temporal-sdk/src/main/java/io/temporal/common/converter/TransferTypeConverter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package io.temporal.common.converter; | ||
|
|
||
| import io.temporal.common.Experimental; | ||
| import java.lang.reflect.Type; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| /** | ||
| * Converts a model to and from a representation handled by the configured {@link DataConverter}. | ||
| * | ||
| * <p>Conversion is applied only to top-level values. The {@code valueType} arguments contain the | ||
| * complete requested model type, including generic arguments. Implementations must be stateless and | ||
| * thread-safe because converter instances are cached. | ||
| * | ||
| * @param <T> annotated model type converted to and from its transfer representation | ||
| */ | ||
| @Experimental | ||
| public interface TransferTypeConverter<T> { | ||
| /** | ||
| * Returns the type used to serialize a model value. | ||
| * | ||
| * @param valueType complete declared model type, including generic arguments | ||
| * @return non-null transfer type | ||
| */ | ||
| Type getTransferType(Type valueType); | ||
|
|
||
| /** Converts a model value to its transfer representation, which may be null. */ | ||
| @Nullable | ||
| Object toTransferType(T value); | ||
|
|
||
| /** | ||
| * Reconstructs a model value from its transfer representation. | ||
| * | ||
| * @param value transfer representation decoded by the configured data converter, which may be | ||
| * null | ||
| * @param valueType complete requested model type, including generic arguments | ||
| */ | ||
| T fromTransferType(@Nullable Object value, Type valueType); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to take a
Typeas a parameter but Go's does not https://github.com/temporalio/sdk-go/blob/2dbb35e53c978457b461e0d8187ea9111f172b64/converter/transfer_types.go#L38There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking more it seems like we need this for generic resolution that will be needed for worker callbacks