mutable_state_impl.go ×6

Frontier kind: Code frontier

unlabeled · c_bc6ac41cbf31

30 tests · 6734 LOC · 231 files · introduces 0 tests · 81 LOC · 4 files

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges81 lines · 4 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1256 ranges6734 lines · 231 files · Browse complete extent
All tests (intent)
30 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.

4 files ranked by introduced lines: 81 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

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

Open complete file

6349 command *commandpb.StartChildWorkflowExecutionCommandAttributes,
6350 targetNamespaceID namespace.ID,
6351 > ) (*historypb.HistoryEvent, *persistencespb.ChildExecutionInfo, error) { mutable_state_impl.go
6352 > opTag := tag.WorkflowActionChildWorkflowInitiated
6353 > if err := ms.checkMutability(opTag); err != nil {
6354 return nil, nil, err
6355 }
6356 > childTSC, childTSStateProp := propagateTimeSkippingToChild(ms.executionInfo) mutable_state_impl.go
6357 > event, batchID := ms.hBuilder.AddStartChildWorkflowExecutionInitiatedEvent(
6358 > workflowTaskCompletedEventID,
6359 > command,
6360 > targetNamespaceID,
6361 > childTSC,
6362 > childTSStateProp,
6363 > )
6364 > ci, err := ms.ApplyStartChildWorkflowExecutionInitiatedEvent(batchID, event)
6365 > if err != nil {
6366 return nil, nil, err
6367 }
6368 // TODO merge active & passive task generation
6369 > if err := ms.taskGenerator.GenerateChildWorkflowTasks( mutable_state_impl.go
6370 > event.GetEventId(),
6371 > ); err != nil {
6372 return nil, nil, err
6373 }
6374 > return event, ci, nil mutable_state_impl.go
6375 }
6376
6377 // generateChildWorkflowRequestID generates a unique request ID for child workflow execution
6378 > func (ms *MutableStateImpl) generateChildWorkflowRequestID(event *historypb.HistoryEvent) string { mutable_state_impl.go
6379 > return fmt.Sprintf("%s:%d:%d", ms.executionState.RunId, event.GetEventId(), event.GetVersion())
6380 > }
6381
6382 func (ms *MutableStateImpl) ApplyStartChildWorkflowExecutionInitiatedEvent(
6383 batchID int64,
6384 event *historypb.HistoryEvent,
6385 > ) (*persistencespb.ChildExecutionInfo, error) { mutable_state_impl.go
6386 > initiatedEventID := event.GetEventId()
6387 > attributes := event.GetStartChildWorkflowExecutionInitiatedEventAttributes()
6388 > ci := &persistencespb.ChildExecutionInfo{
6389 > Version: event.GetVersion(),
6390 > InitiatedEventId: initiatedEventID,
6391 > InitiatedEventBatchId: batchID,
6392 > StartedEventId: common.EmptyEventID,
6393 > StartedWorkflowId: attributes.GetWorkflowId(),
6394 > CreateRequestId: ms.generateChildWorkflowRequestID(event),
6395 > Namespace: attributes.GetNamespace(),
6396 > NamespaceId: attributes.GetNamespaceId(),
6397 > WorkflowTypeName: attributes.GetWorkflowType().GetName(),
6398 > ParentClosePolicy: attributes.GetParentClosePolicy(),
6399 > Priority: attributes.Priority,
6400 > }
6401 >
6402 > ms.pendingChildExecutionInfoIDs[ci.InitiatedEventId] = ci
6403 > ms.updateChildExecutionInfos[ci.InitiatedEventId] = ci
6404 > ms.approximateSize += ci.Size() + int64SizeBytes
6405 > ms.executionInfo.ChildExecutionCount++
6406 >
6407 > ms.writeEventToCache(event)
6408 > return ci, nil
6409 > }
6410
6411 func (ms *MutableStateImpl) AddChildWorkflowExecutionStartedEvent(
go.temporal.io/server/service/history/workflow/task_generator.go 19 introduced LOC · 3 ranges

Open complete file

600 func (r *TaskGeneratorImpl) GenerateChildWorkflowTasks(
601 childInitiatedEventId int64,
602 > ) error { task_generator.go
603 >
604 > childWorkflowInfo, ok := r.mutableState.GetChildExecutionInfo(childInitiatedEventId)
605 > if !ok {
606 return serviceerror.NewInternalf("it could be a bug, cannot get pending child workflow: %v", childInitiatedEventId)
607 }
608
609 > targetNamespaceID, err := r.getTargetNamespaceID( task_generator.go
610 > namespace.Name(childWorkflowInfo.GetNamespace()),
611 > namespace.ID(childWorkflowInfo.GetNamespaceId()),
612 > )
613 > if err != nil {
614 return err
615 }
616
617 > r.mutableState.AddTasks(&tasks.StartChildExecutionTask{ task_generator.go
618 > // TaskID, VisibilityTimestamp is set by shard
619 > WorkflowKey: r.mutableState.GetWorkflowKey(),
620 > TargetNamespaceID: targetNamespaceID.String(),
621 > TargetWorkflowID: childWorkflowInfo.StartedWorkflowId,
622 > InitiatedEventID: childWorkflowInfo.InitiatedEventId,
623 > Version: childWorkflowInfo.Version,
624 > })
625 >
626 > return nil
627 }
628
go.temporal.io/server/service/history/workflow/timeskipping.go 9 introduced LOC · 2 ranges

Open complete file

161 func propagateTimeSkippingToChild(
162 source *persistencespb.WorkflowExecutionInfo,
163 > ) (*commonpb.TimeSkippingConfig, *commonpb.TimeSkippingStatePropagation) { timeskipping.go
164 > accum := accumulatedSkippedDuration(source)
165 > var stateProp *commonpb.TimeSkippingStatePropagation
166 > if accum > 0 {
167 stateProp = &commonpb.TimeSkippingStatePropagation{
168 InitialSkippedDuration: durationpb.New(accum),
170 }
171
172 > enabled := source.GetTimeSkippingInfo().GetConfig().GetEnabled() timeskipping.go
173 > disablePropagation := source.GetTimeSkippingInfo().GetConfig().GetDisablePropagation()
174 > if !enabled || disablePropagation {
175 > return nil, stateProp
176 > }
177
178 return &commonpb.TimeSkippingConfig{
go.temporal.io/server/api/persistence/v1/executions.pb.go 8 introduced LOC · 2 ranges

Open complete file

3462 }
3463
3464 > func (x *ChildExecutionInfo) GetNamespace() string { executions.pb.go
3465 > if x != nil {
3466 > return x.Namespace
3467 > }
3468 return ""
3469 }
3497 }
3498
3499 > func (x *ChildExecutionInfo) GetNamespaceId() string { executions.pb.go
3500 > if x != nil {
3501 > return x.NamespaceId
3502 > }
3503 return ""
3504 }