mutable_state_impl.go ×6

Frontier kind: Code frontier

unlabeled · c_f8f6df7801cc

6 tests · 7876 LOC · 247 files · introduces 0 tests · 88 LOC · 6 files

Introduces — evidence that enters the hierarchy at this concept

Code
17 ranges88 lines · 6 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1547 ranges7876 lines · 247 files · Browse complete extent
All tests (intent)
6 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.

6 files ranked by introduced lines: 88 introduced LOC across 17 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/workflow/mutable_state_impl.go 32 introduced LOC · 6 ranges

Open complete file

1712 func (ms *MutableStateImpl) GetRequestCancelInfo(
1713 initiatedEventID int64,
1714 > ) (*persistencespb.RequestCancelInfo, bool) { mutable_state_impl.go
1715 > ri, ok := ms.pendingRequestCancelInfoIDs[initiatedEventID]
1716 > return ri, ok
1717 > }
1718
1719 func (ms *MutableStateImpl) GetRequesteCancelExternalInitiatedEvent(
5051 command *commandpb.RequestCancelExternalWorkflowExecutionCommandAttributes,
5052 targetNamespaceID namespace.ID,
5053 > ) (*historypb.HistoryEvent, *persistencespb.RequestCancelInfo, error) { mutable_state_impl.go
5054 > opTag := tag.WorkflowActionExternalWorkflowCancelInitiated
5055 > if err := ms.checkMutability(opTag); err != nil {
5056 return nil, nil, err
5057 }
5058
5059 > event, batchID := ms.hBuilder.AddRequestCancelExternalWorkflowExecutionInitiatedEvent(workflowTaskCompletedEventID, command, targetNamespaceID) mutable_state_impl.go
5060 > rci, err := ms.ApplyRequestCancelExternalWorkflowExecutionInitiatedEvent(batchID, event, cancelRequestID)
5061 > if err != nil {
5062 return nil, nil, err
5063 }
5064 // TODO merge active & passive task generation
5065 > if err := ms.taskGenerator.GenerateRequestCancelExternalTasks( mutable_state_impl.go
5066 > event,
5067 > ); err != nil {
5068 return nil, nil, err
5069 }
5070 > return event, rci, nil mutable_state_impl.go
5071 }
5072
5075 event *historypb.HistoryEvent,
5076 cancelRequestID string,
5077 > ) (*persistencespb.RequestCancelInfo, error) { mutable_state_impl.go
5078 > // TODO: Evaluate if we need cancelRequestID also part of history event
5079 > initiatedEventID := event.GetEventId()
5080 > rci := &persistencespb.RequestCancelInfo{
5081 > Version: event.GetVersion(),
5082 > InitiatedEventBatchId: batchID,
5083 > InitiatedEventId: initiatedEventID,
5084 > CancelRequestId: cancelRequestID,
5085 > }
5086 >
5087 > ms.pendingRequestCancelInfoIDs[rci.InitiatedEventId] = rci
5088 > ms.updateRequestCancelInfos[rci.InitiatedEventId] = rci
5089 > ms.approximateSize += rci.Size() + int64SizeBytes
5090 > ms.executionInfo.RequestCancelExternalCount++
5091 >
5092 > ms.writeEventToCache(event)
5093 > return rci, nil
5094 > }
5095
5096 func (ms *MutableStateImpl) AddExternalWorkflowExecutionCancelRequested(
go.temporal.io/server/service/history/tasks/requst_cancel_task.go 25 introduced LOC · 5 ranges

Open complete file

29 )
30
31 > func (u *CancelExecutionTask) GetKey() Key { requst_cancel_task.go
32 > return NewImmediateKey(u.TaskID)
33 > }
34
35 func (u *CancelExecutionTask) GetVersion() int64 {
41 }
42
43 > func (u *CancelExecutionTask) GetTaskID() int64 { requst_cancel_task.go
44 > return u.TaskID
45 > }
46
47 func (u *CancelExecutionTask) SetTaskID(id int64) {
49 }
50
51 > func (u *CancelExecutionTask) GetVisibilityTime() time.Time { requst_cancel_task.go
52 > return u.VisibilityTimestamp
53 > }
54
55 func (u *CancelExecutionTask) SetVisibilityTime(timestamp time.Time) {
61 }
62
63 > func (u *CancelExecutionTask) GetType() enumsspb.TaskType { requst_cancel_task.go
64 > return enumsspb.TASK_TYPE_TRANSFER_CANCEL_EXECUTION
65 > }
66
67 > func (u *CancelExecutionTask) String() string { requst_cancel_task.go
68 > return fmt.Sprintf("CancelExecutionTask{WorkflowKey: %s, VisibilityTimestamp: %v, TaskID: %v, TargetNamespaceID: %v, TargetWorkflowID: %v, TargetRunID: %v, TargetChildWorkflowOnly: %v, InitiatedEventID: %v, Version: %v}",
69 > u.WorkflowKey.String(),
70 > u.VisibilityTimestamp,
71 > u.TaskID,
72 > u.TargetNamespaceID,
73 > u.TargetWorkflowID,
74 > u.TargetRunID,
75 > u.TargetChildWorkflowOnly,
76 > u.InitiatedEventID,
77 > u.Version,
78 > )
79 > }
go.temporal.io/server/service/history/workflow/task_generator.go 25 introduced LOC · 3 ranges

Open complete file

632 func (r *TaskGeneratorImpl) GenerateRequestCancelExternalTasks(
633 event *historypb.HistoryEvent,
634 > ) error { task_generator.go
635 >
636 > attr := event.GetRequestCancelExternalWorkflowExecutionInitiatedEventAttributes()
637 > scheduledEventID := event.GetEventId()
638 > version := event.GetVersion()
639 > targetWorkflowID := attr.GetWorkflowExecution().GetWorkflowId()
640 > targetRunID := attr.GetWorkflowExecution().GetRunId()
641 > targetChildOnly := attr.GetChildWorkflowOnly()
642 >
643 > _, ok := r.mutableState.GetRequestCancelInfo(scheduledEventID)
644 > if !ok {
645 return serviceerror.NewInternalf("it could be a bug, cannot get pending request cancel external workflow: %v", scheduledEventID)
646 }
647
648 > targetNamespaceID, err := r.getTargetNamespaceID(namespace.Name(attr.GetNamespace()), namespace.ID(attr.GetNamespaceId())) task_generator.go
649 > if err != nil {
650 return err
651 }
652
653 > r.mutableState.AddTasks(&tasks.CancelExecutionTask{ task_generator.go
654 > // TaskID, VisibilityTimestamp is set by shard
655 > WorkflowKey: r.mutableState.GetWorkflowKey(),
656 > TargetNamespaceID: targetNamespaceID.String(),
657 > TargetWorkflowID: targetWorkflowID,
658 > TargetRunID: targetRunID,
659 > TargetChildWorkflowOnly: targetChildOnly,
660 > InitiatedEventID: scheduledEventID,
661 > Version: version,
662 > })
663 >
664 > return nil
665 }
666
go.temporal.io/server/api/enums/v1/task.pb.go 2 introduced LOC · 1 range

Open complete file

231 case TASK_TYPE_TRANSFER_CLOSE_EXECUTION:
232 return "TransferCloseExecution"
233 > case TASK_TYPE_TRANSFER_CANCEL_EXECUTION: task.pb.go
234 > return "TransferCancelExecution"
235
236 // Deprecated: Use TaskType.Descriptor instead.
go.temporal.io/server/service/history/queues/metrics.go 2 introduced LOC · 1 range

Open complete file

39 case *tasks.CloseExecutionTask:
40 return metrics.TaskTypeTransferActiveTaskCloseExecution
41 > case *tasks.CancelExecutionTask: metrics.go
42 > return metrics.TaskTypeTransferActiveTaskCancelExecution
43 case *tasks.SignalExecutionTask:
44 return metrics.TaskTypeTransferActiveTaskSignalExecution
go.temporal.io/server/service/history/tasks/utils.go 2 introduced LOC · 1 range

Open complete file

69 case *DeleteExecutionTask:
70 return getChasmTaskEventID()
71 > case *CancelExecutionTask: utils.go
72 > eventID = task.InitiatedEventID
73 case *SignalExecutionTask:
74 eventID = task.InitiatedEventID