api.go ×13

Frontier kind: Code frontier

unlabeled · c_336e9f7d4e7a

3 tests · 8940 LOC · 227 files · introduces 0 tests · 72 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges72 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1958 ranges8940 lines · 227 files · Browse complete extent
All tests (intent)
3 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.

3 files ranked by introduced lines: 72 introduced LOC across 15 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/api/recordactivitytaskstarted/api.go 64 introduced LOC · 13 ranges

Open complete file

171 }
172
173 > code, err := processActivityWorkflowRules(shardContext, request, mutableState, ai) api.go
174 > if err != nil || code == rejectCodePaused {
175 return nil, code, err
176 }
177
178 > if ai.Stamp != request.Stamp { api.go
179 // This happens when the workflow task was rescheduled.
180 errorMessage := fmt.Sprintf(
184 }
185
186 > wfBehavior := mutableState.GetEffectiveVersioningBehavior() api.go
187 > wfDeployment := mutableState.GetEffectiveDeployment()
188 > //nolint:staticcheck // SA1019 deprecated WorkerVersionCapabilities will clean up later
189 > pollerDeployment, err := worker_versioning.DeploymentFromCapabilities(request.PollRequest.WorkerVersionCapabilities, request.PollRequest.DeploymentOptions)
190 > if err != nil {
191 return nil, rejectCodeUndefined, err
192 }
193 > err = worker_versioning.ValidateTaskVersionDirective(request.GetVersionDirective(), wfBehavior, wfDeployment, request.ScheduledDeployment) api.go
194 > if err != nil {
195 return nil, rejectCodeUndefined, err
196 }
197
198 > if mutableState.GetDeploymentTransition() != nil { api.go
199 // Can't start activity during a redirect. We reject this request so Matching drops
200 // the task. The activity will be rescheduled when the redirect completes/fails.
202 }
203
204 > if !pollerDeployment.Equal(wfDeployment) && api.go
205 > // Independent activities of pinned workflows are redirected. They should not start a transition on wf.
206 > wfBehavior != enumspb.VERSIONING_BEHAVIOR_PINNED {
207 // AT of an unpinned workflow is redirected, see if a transition on the workflow should start.
208 // The workflow transition happens only if the workflow task of the same execution would go
254 // commands). On retries of this RPC, we return the stored clock from the early return
255 // path above.
256 > clock, err := shardContext.NewVectorClock() api.go
257 > if err != nil {
258 return nil, rejectCodeUndefined, err
259 }
260 > versioningStamp := worker_versioning.StampFromCapabilities(request.PollRequest.WorkerVersionCapabilities, request.PollRequest.DeploymentOptions) //nolint:staticcheck // SA1019: WorkerVersionCapabilities is deprecated but still used for old versioning [cleanup-old-wv] api.go
261 > if _, err := mutableState.AddActivityTaskStartedEvent(
262 > ai, scheduledEventID, requestID, request.PollRequest.GetIdentity(),
263 > versioningStamp, pollerDeployment, request.GetBuildIdRedirectInfo(),
264 > request.PollRequest.GetWorkerControlTaskQueue(),
265 > clock,
266 > ); err != nil {
267 return nil, rejectCodeUndefined, err
268 }
269
270 > scheduleToStartLatency := ai.GetStartedTime().AsTime().Sub(ai.GetScheduledTime().AsTime()) api.go
271 > metrics.TaskScheduleToStartLatency.With(
272 > metrics.GetPerTaskQueuePartitionTypeScope(
273 > taggedMetrics,
274 > namespaceName,
275 > // passing the root partition all the time as we don't care about partition ID in this metric
276 > tqid.UnsafeTaskQueueFamily(namespaceEntry.ID().String(),
277 > ai.GetTaskQueue()).TaskQueue(enumspb.TASK_QUEUE_TYPE_ACTIVITY).RootPartition(),
278 > shardContext.GetConfig().BreakdownMetricsByTaskQueue(namespaceName,
279 > ai.GetTaskQueue(),
280 > enumspb.TASK_QUEUE_TYPE_ACTIVITY),
281 > ),
282 > ).Record(scheduleToStartLatency)
283 >
284 > response.Clock = clock
285 >
286 > response.StartedTime = ai.StartedTime
287 > response.Attempt = ai.Attempt
288 > response.HeartbeatDetails = ai.LastHeartbeatDetails
289 > response.Version = ai.Version
290 > response.StartVersion = ai.StartVersion
291 >
292 > response.WorkflowType = mutableState.GetWorkflowType()
293 > response.WorkflowNamespace = namespaceName
294 > response.RetryPolicy = &commonpb.RetryPolicy{
295 > InitialInterval: ai.RetryInitialInterval,
296 > BackoffCoefficient: ai.RetryBackoffCoefficient,
297 > MaximumInterval: ai.RetryMaximumInterval,
298 > MaximumAttempts: ai.RetryMaximumAttempts,
299 > NonRetryableErrorTypes: ai.RetryNonRetryableErrorTypes,
300 > }
301 >
302 > return response, rejectCodeAccepted, nil
303 }
304
358 ms historyi.MutableState,
359 ai *persistencespb.ActivityInfo,
360 > ) (rejectCode, error) { api.go
361 > if ai.Stamp == request.Stamp && ai.Paused {
362 // this shouldn't happen. For now log an error
363 shardContext.GetLogger().Error(
370 // if activity is already paused or Stamp is not the same as the one in the request we shouldn't process workflow rules
371 // this is a no-op
372 > if ai.Stamp != request.Stamp || ai.Paused { api.go
373 return rejectCodeUndefined, nil
374 }
377 // We only need to process the first invocation of an activity.
378 // Other invocations should be blocked by either RetryActivity or retryTask.
379 > if ai.Attempt > 1 { api.go
380 return rejectCodeUndefined, nil
381 }
382
383 > ruleMatched := workflow.ActivityMatchWorkflowRules(ms, shardContext.GetTimeSource(), shardContext.GetLogger(), ai) api.go
384 > if !ruleMatched || !ai.Paused {
385 > return rejectCodeUndefined, nil
386 > }
387
388 // activity was paused, need to update activity
go.temporal.io/server/api/historyservice/v1/request_response.pb.go 4 introduced LOC · 1 range

Open complete file

1848 }
1849
1850 > func (x *RecordActivityTaskStartedRequest) GetBuildIdRedirectInfo() *v113.BuildIdRedirectInfo { request_response.pb.go
1851 > if x != nil {
1852 > return x.BuildIdRedirectInfo
1853 > }
1854 return nil
1855 }
go.temporal.io/server/api/persistence/v1/executions.pb.go 4 introduced LOC · 1 range

Open complete file

3011 }
3012
3013 > func (x *ActivityInfo) GetTaskQueue() string { executions.pb.go
3014 > if x != nil {
3015 > return x.TaskQueue
3016 > }
3017 return ""
3018 }