activity.go ×9

Frontier kind: Code frontier

unlabeled · c_a87f9290c93c

4 tests · 4610 LOC · 195 files · introduces 0 tests · 60 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges60 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
720 ranges4610 lines · 195 files · Browse complete extent
All tests (intent)
4 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.

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

go.temporal.io/server/service/history/workflow/activity.go 49 introduced LOC · 9 ranges

Open complete file

95 mutableState historyi.MutableState,
96 ai *persistencespb.ActivityInfo,
97 > ) (*workflowpb.PendingActivityInfo, error) { activity.go
98 > now := shardContext.GetTimeSource().Now().UTC()
99 >
100 > p := &workflowpb.PendingActivityInfo{
101 > ActivityId: ai.ActivityId,
102 > LastWorkerDeploymentVersion: ai.LastWorkerDeploymentVersion,
103 > LastDeploymentVersion: ai.LastDeploymentVersion,
104 > Priority: ai.Priority,
105 > }
106 > if ai.GetUseWorkflowBuildIdInfo() != nil {
107 p.AssignedBuildId = &workflowpb.PendingActivityInfo_UseWorkflowBuildId{UseWorkflowBuildId: &emptypb.Empty{}}
108 > } else if ai.GetLastIndependentlyAssignedBuildId() != "" { activity.go
109 p.AssignedBuildId = &workflowpb.PendingActivityInfo_LastIndependentlyAssignedBuildId{
110 LastIndependentlyAssignedBuildId: ai.GetLastIndependentlyAssignedBuildId(),
112 }
113
114 > p.State = GetActivityState(ai) activity.go
115 >
116 > p.LastAttemptCompleteTime = ai.LastAttemptCompleteTime
117 > if !ai.HasRetryPolicy {
118 p.NextAttemptScheduleTime = nil
119 > } else { activity.go
120 p.Attempt = ai.Attempt
121 if p.State == enumspb.PENDING_ACTIVITY_STATE_SCHEDULED {
135 }
136 }
137 > p.Attempt = max(p.Attempt, 1) activity.go
138 > p.Paused = ai.Paused
139 >
140 > if ai.LastHeartbeatUpdateTime != nil && !ai.LastHeartbeatUpdateTime.AsTime().IsZero() {
141 p.LastHeartbeatTime = ai.LastHeartbeatUpdateTime
142 p.HeartbeatDetails = ai.LastHeartbeatDetails
143 }
144 > var err error activity.go
145 > p.ActivityType, err = mutableState.GetActivityType(ctx, ai)
146 > if err != nil {
147 return nil, err
148 }
149 > p.ScheduledTime = ai.ScheduledTime activity.go
150 > p.LastStartedTime = ai.StartedTime
151 > p.LastWorkerIdentity = ai.StartedIdentity
152 > if ai.HasRetryPolicy {
153 p.ExpirationTime = ai.RetryExpirationTime
154 p.MaximumAttempts = ai.RetryMaximumAttempts
159 }
160
161 > if ai.Paused { activity.go
162 // adjust activity state for paused activities
163 if p.State == enumspb.PENDING_ACTIVITY_STATE_SCHEDULED {
199 }
200
201 > p.ActivityOptions = &activitypb.ActivityOptions{ activity.go
202 > TaskQueue: &taskqueuepb.TaskQueue{
203 > // we may need to return sticky task queue name here
204 > Name: ai.TaskQueue,
205 > NormalName: ai.TaskQueue,
206 > },
207 > ScheduleToCloseTimeout: ai.ScheduleToCloseTimeout,
208 > ScheduleToStartTimeout: ai.ScheduleToStartTimeout,
209 > StartToCloseTimeout: ai.StartToCloseTimeout,
210 > HeartbeatTimeout: ai.HeartbeatTimeout,
211 > Priority: ai.Priority,
212 >
213 > RetryPolicy: &commonpb.RetryPolicy{
214 > InitialInterval: ai.RetryInitialInterval,
215 > BackoffCoefficient: ai.RetryBackoffCoefficient,
216 > MaximumInterval: ai.RetryMaximumInterval,
217 > MaximumAttempts: ai.RetryMaximumAttempts,
218 > },
219 > }
220 >
221 > return p, nil
222 }
223
go.temporal.io/server/service/history/interfaces/mutable_state_mock.go 11 introduced LOC · 2 ranges

Open complete file

2094
2095 // GetActivityType mocks base method.
2096 > func (m *MockMutableState) GetActivityType(arg0 context.Context, arg1 *persistence.ActivityInfo) (*common.ActivityType, error) { mutable_state_mock.go
2097 > m.ctrl.T.Helper()
2098 > ret := m.ctrl.Call(m, "GetActivityType", arg0, arg1)
2099 > ret0, _ := ret[0].(*common.ActivityType)
2100 > ret1, _ := ret[1].(error)
2101 > return ret0, ret1
2102 > }
2103
2104 // GetActivityType indicates an expected call of GetActivityType.
2105 > func (mr *MockMutableStateMockRecorder) GetActivityType(arg0, arg1 any) *gomock.Call { mutable_state_mock.go
2106 > mr.mock.ctrl.T.Helper()
2107 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetActivityType", reflect.TypeOf((*MockMutableState)(nil).GetActivityType), arg0, arg1)
2108 > }
2109
2110 // GetApproximatePersistedSize mocks base method.