mutable_state_impl.go ×8

Frontier kind: Code frontier

unlabeled · c_b903cfdb0fbf

2 tests · 7757 LOC · 228 files · introduces 0 tests · 50 LOC · 5 files

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges50 lines · 5 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1623 ranges7757 lines · 228 files · Browse complete extent
All tests (intent)
2 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

5 files ranked by introduced lines: 50 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/workflow/mutable_state_impl.go 27 introduced LOC · 8 ranges

Open complete file

3214 reason string,
3215 requestID string,
3216 > ) (*historypb.HistoryEvent, error) { mutable_state_impl.go
3217 > opTag := tag.WorkflowActionWorkflowPaused
3218 > if err := ms.checkMutability(opTag); err != nil {
3219 return nil, err
3220 }
3221 > event := ms.hBuilder.AddWorkflowExecutionPausedEvent(identity, reason, requestID) mutable_state_impl.go
3222 > if err := ms.ApplyWorkflowExecutionPausedEvent(event); err != nil {
3223 return nil, err
3224 }
3225 > return event, nil mutable_state_impl.go
3226 }
3227
3228 // ApplyWorkflowExecutionPausedEvent applies the paused event to the mutable state. It updates the workflow execution status to paused and sets the pause info.
3229 > func (ms *MutableStateImpl) ApplyWorkflowExecutionPausedEvent(event *historypb.HistoryEvent) error { mutable_state_impl.go
3230 > // Update workflow status.
3231 > if _, err := ms.UpdateWorkflowStateStatus(ms.executionState.GetState(), enumspb.WORKFLOW_EXECUTION_STATUS_PAUSED); err != nil {
3232 return err
3233 }
3234 // Set pause info in mutable state.
3235 > ms.executionInfo.PauseInfo = &persistencespb.WorkflowPauseInfo{ mutable_state_impl.go
3236 > PauseTime: timestamppb.New(event.GetEventTime().AsTime()),
3237 > Identity: event.GetWorkflowExecutionPausedEventAttributes().GetIdentity(),
3238 > Reason: event.GetWorkflowExecutionPausedEventAttributes().GetReason(),
3239 > RequestId: event.GetWorkflowExecutionPausedEventAttributes().GetRequestId(),
3240 > }
3241 >
3242 > // Update approximate size of the mutable state. This will be decreased when the pause info is removed (when the workflow is unpaused)
3243 > ms.approximateSize += ms.executionInfo.PauseInfo.Size()
3244 >
3245 > // Invalidate all the pending activities. Do not mark individual activities as paused.
3246 > for _, ai := range ms.GetPendingActivityInfos() {
3247 if err := ms.UpdateActivity(ai.ScheduledEventId, func(activityInfo *persistencespb.ActivityInfo, _ historyi.MutableState) error {
3248 activityInfo.Stamp = activityInfo.Stamp + 1
3262 // will ever resolve it, since it has no timeout of its own and dispatching it
3263 // to a worker now would violate pause semantics.
3264 > if ms.HasPendingWorkflowTask() && !ms.HasStartedWorkflowTask() { mutable_state_impl.go
3265 // Fail it explicitly, in the same transaction as the paused event, so it
3266 // resolves cleanly in history instead of being left scheduled forever. A
6954 // Add workflow pause entries if workflow is paused
6955 if ms.executionInfo.PauseInfo != nil {
6956 > entries = append(entries, fmt.Sprintf("Workflow:%s", ms.GetWorkflowKey().WorkflowID)) mutable_state_impl.go
6957 > if reason := ms.executionInfo.PauseInfo.Reason; reason != "" {
6958 > entries = append(entries, fmt.Sprintf("Reason:%s", reason))
6959 > }
6960 }
6961
go.temporal.io/server/service/history/historybuilder/event_factory.go 11 introduced LOC · 1 range

Open complete file

1055 reason string,
1056 requestID string,
1057 > ) *historypb.HistoryEvent { event_factory.go
1058 > event := b.createHistoryEvent(enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_PAUSED, b.timeSource.Now())
1059 > event.Attributes = &historypb.HistoryEvent_WorkflowExecutionPausedEventAttributes{
1060 > WorkflowExecutionPausedEventAttributes: &historypb.WorkflowExecutionPausedEventAttributes{
1061 > Identity: identity,
1062 > Reason: reason,
1063 > RequestId: requestID,
1064 > },
1065 > }
1066 > return event
1067 > }
1068
1069 func (b *EventFactory) CreateWorkflowExecutionUnpausedEvent(
go.temporal.io/server/service/history/historybuilder/history_builder.go 7 introduced LOC · 1 range

Open complete file

294 reason string,
295 requestID string,
296 > ) *historypb.HistoryEvent { history_builder.go
297 > event := b.CreateWorkflowExecutionPausedEvent(identity, reason, requestID)
298 > // Mark the event as 'worker may ignore' so that older SDKs can safely ignore it.
299 > event.WorkerMayIgnore = true
300 > event, _ = b.add(event)
301 > return event
302 > }
303
304 func (b *HistoryBuilder) AddWorkflowExecutionUnpausedEvent(
go.temporal.io/server/api/persistence/v1/executions.go-helpers.pb.go 3 introduced LOC · 1 range

Open complete file

1090
1091 // Size returns the size of the object, in bytes, once serialized
1092 > func (val *WorkflowPauseInfo) Size() int { executions.go-helpers.pb.go
1093 > return proto.Size(val)
1094 > }
1095
1096 // Equal returns whether two WorkflowPauseInfo values are equivalent by recursively
go.temporal.io/server/service/history/workflow/mutable_state_state_status.go 2 introduced LOC · 1 range

Open complete file

54 return invalidStateTransitionErr(e.GetState(), state, status)
55
56 > case enumsspb.WORKFLOW_EXECUTION_STATE_RUNNING: mutable_state_state_status.go
57 > if status != enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING && status != enumspb.WORKFLOW_EXECUTION_STATUS_PAUSED {
58 return invalidStateTransitionErr(e.GetState(), state, status)
59 }