-
Notifications
You must be signed in to change notification settings - Fork 187
Add summary to side effect and mutable side effect #2699
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| import io.temporal.api.enums.v1.EventType; | ||
| import io.temporal.api.history.v1.HistoryEvent; | ||
| import io.temporal.api.history.v1.MarkerRecordedEventAttributes; | ||
| import io.temporal.api.sdk.v1.UserMetadata; | ||
| import io.temporal.common.converter.DefaultDataConverter; | ||
| import io.temporal.common.converter.StdConverterBackwardsCompatAdapter; | ||
| import io.temporal.workflow.Functions; | ||
|
|
@@ -24,6 +25,7 @@ final class MutableSideEffectStateMachine { | |
| static final String MUTABLE_SIDE_EFFECT_MARKER_NAME = "MutableSideEffect"; | ||
|
|
||
| private final String id; | ||
| private UserMetadata metadata; | ||
| private final Functions.Func<Boolean> replaying; | ||
| private final Functions.Proc1<CancellableCommand> commandSink; | ||
|
|
||
|
|
@@ -174,7 +176,8 @@ State createMarker() { | |
| .setMarkerName(MUTABLE_SIDE_EFFECT_MARKER_NAME) | ||
| .putAllDetails(details) | ||
| .build(); | ||
| addCommand(StateMachineCommandUtils.createRecordMarker(markerAttributes)); | ||
| addCommand(StateMachineCommandUtils.createRecordMarker(markerAttributes, metadata)); | ||
| metadata = null; // only used once | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For my own understanding, why do we null after recording once? Is it because replay is the only time we'd re-create a marker, and we don't need this for replay?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Otherwise we just hold the metadata in memory when we no longer need it, just a memory optimization. |
||
| currentSkipCount = 0; | ||
| return State.MARKER_COMMAND_CREATED; | ||
| } | ||
|
|
@@ -244,18 +247,22 @@ void cancelCommandNotifyCachedResult() { | |
| /** Creates new MutableSideEffectStateMachine */ | ||
| public static MutableSideEffectStateMachine newInstance( | ||
| String id, | ||
| UserMetadata metadata, | ||
| Functions.Func<Boolean> replaying, | ||
| Functions.Proc1<CancellableCommand> commandSink, | ||
| Functions.Proc1<StateMachine> stateMachineSink) { | ||
| return new MutableSideEffectStateMachine(id, replaying, commandSink, stateMachineSink); | ||
| return new MutableSideEffectStateMachine( | ||
| id, metadata, replaying, commandSink, stateMachineSink); | ||
| } | ||
|
|
||
| private MutableSideEffectStateMachine( | ||
| String id, | ||
| UserMetadata metadata, | ||
| Functions.Func<Boolean> replaying, | ||
| Functions.Proc1<CancellableCommand> commandSink, | ||
| Functions.Proc1<StateMachine> stateMachineSink) { | ||
| this.id = Objects.requireNonNull(id); | ||
| this.metadata = metadata; | ||
| this.replaying = Objects.requireNonNull(replaying); | ||
| this.commandSink = Objects.requireNonNull(commandSink); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.