create_workflow_util.go ×11

Frontier kind: Code frontier

unlabeled · c_ae7232dbe18b

45 tests · 6478 LOC · 212 files · introduces 0 tests · 68 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges68 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1295 ranges6478 lines · 212 files · Browse complete extent
All tests (intent)
45 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.

1 file ranked by introduced lines: 68 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/api/create_workflow_util.go 68 introduced LOC · 11 ranges

Open complete file

49 startRequest *historyservice.StartWorkflowExecutionRequest,
50 signalWithStartRequest *workflowservice.SignalWithStartWorkflowExecutionRequest,
51 > ) (historyi.MutableState, error) { create_workflow_util.go
52 > newMutableState, err := CreateMutableState(
53 > shard,
54 > namespaceEntry,
55 > startRequest.StartRequest.WorkflowExecutionTimeout,
56 > startRequest.StartRequest.WorkflowRunTimeout,
57 > workflowID,
58 > runID,
59 > )
60 > if err != nil {
61 return nil, err
62 }
63
64 > startEvent, err := newMutableState.AddWorkflowExecutionStartedEvent( create_workflow_util.go
65 > &commonpb.WorkflowExecution{
66 > WorkflowId: workflowID,
67 > RunId: runID,
68 > },
69 > startRequest,
70 > )
71 > if err != nil {
72 return nil, err
73 }
74
75 > if signalWithStartRequest != nil { create_workflow_util.go
76 if signalWithStartRequest.GetRequestId() != "" {
77 newMutableState.AddSignalRequested(signalWithStartRequest.GetRequestId())
88 }
89 }
90 > requestEagerExecution := startRequest.StartRequest.GetRequestEagerExecution() create_workflow_util.go
91 >
92 > var scheduledEventID int64
93 > // Generate first workflow task event if not child WF and no first workflow task backoff
94 > scheduledEventID, err = GenerateFirstWorkflowTask(
95 > newMutableState,
96 > startRequest.ParentExecutionInfo,
97 > startEvent,
98 > requestEagerExecution,
99 > )
100 > if err != nil {
101 return nil, err
102 }
103
104 // If first workflow task should back off (e.g. cron or workflow retry) a workflow task will not be scheduled.
105 > if requestEagerExecution && newMutableState.HasPendingWorkflowTask() { create_workflow_util.go
106 // TODO: get build ID from Starter so eager workflows can be versioned
107 _, _, err = newMutableState.AddWorkflowTaskStartedEvent(
131 shardCtx historyi.ShardContext,
132 ms historyi.MutableState,
133 > ) (WorkflowLease, error) { create_workflow_util.go
134 > // TODO(stephanos): remove this hack
135 > if existingLease != nil {
136 return existingLease, nil
137 }
138 > return NewWorkflowLease( create_workflow_util.go
139 > workflow.NewContext(
140 > shardCtx.GetConfig(),
141 > definition.NewWorkflowKey(
142 > ms.GetNamespaceEntry().ID().String(),
143 > ms.GetExecutionInfo().WorkflowId,
144 > ms.GetExecutionState().RunId,
145 > ),
146 > chasm.WorkflowArchetypeID,
147 > shardCtx.GetLogger(),
148 > shardCtx.GetThrottledLogger(),
149 > shardCtx.GetMetricsHandler(),
150 > ),
151 > wcache.NoopReleaseFn,
152 > ms,
153 > ), nil
154 }
155
161 workflowID string,
162 runID string,
163 > ) (historyi.MutableState, error) { create_workflow_util.go
164 > newMutableState := workflow.NewMutableState(
165 > shard,
166 > shard.GetEventsCache(),
167 > shard.GetLogger(),
168 > namespaceEntry,
169 > workflowID,
170 > runID,
171 > shard.GetTimeSource().Now(),
172 > )
173 > if err := newMutableState.SetHistoryTree(executionTimeout, runTimeout, runID); err != nil {
174 return nil, err
175 }
176 > return newMutableState, nil create_workflow_util.go
177 }
178
182 startEvent *historypb.HistoryEvent,
183 bypassTaskGeneration bool,
184 > ) (int64, error) { create_workflow_util.go
185 > if parentInfo == nil {
186 > // WorkflowTask is only created when it is not a Child Workflow and no backoff is needed
187 > return mutableState.AddFirstWorkflowTaskScheduled(nil, startEvent, bypassTaskGeneration)
188 > }
189 return 0, nil
190 }