partition_scaler_mock.go ×3

Frontier kind: Code frontier

unlabeled · c_f8cd83295924

25 tests · 3013 LOC · 149 files · introduces 0 tests · 42 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges42 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
482 ranges3013 lines · 149 files · Browse complete extent
All tests (intent)
25 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: 42 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/scale_manager.go 26 introduced LOC · 3 ranges

Open complete file

167 // changed.
168 // Called from backgroundWork only.
169 > func (sm *scaleManager) callScaler() { scale_manager.go
170 > // don't bother calling during cooldown period
171 > if !sm.nextDecision.IsZero() && sm.timeSource.Now().Before(sm.nextDecision) {
172 return
173 }
174
175 > settings := sm.settings() scale_manager.go
176 > shadowMode := settings.ShadowModeLogInterval > 0
177 >
178 > // Entering shadow mode on top of a previously-applied managed target releases
179 > // control back to the dynamic-config baseline: zero the managed target once so
180 > // the write side follows dynamic config again (and tracks future config
181 > // changes), and cold-start the shadow simulation from the baseline. BacklogState
182 > // is preserved, so read partitions are not dropped here (reclaiming them is left
183 > // to the drain path). This is the only state shadow mode writes; it still never
184 > // applies the scaler's hypothetical decisions.
185 > if shadowMode && sm.scaleState.GetTarget() != 0 {
186 sm.releaseManagedState(settings)
187 }
188
189 // grab current batch (may be zero)
190 > tasks := int(sm.batch.Swap(0)) scale_manager.go
191 >
192 > decision := sm.partitionScaler.OnTasks(PartitionScalerInput{
193 > NumTasks: tasks,
194 > CurrentTarget: int(sm.scaleState.GetTarget()),
195 > BacklogCounts: sm.scaleState.GetBacklogCounts(),
196 > PrivateState: sm.scaleState.GetPrivateScalerState(),
197 > })
198 > backlogCapC8 := number.EncodeCompact8(int64(decision.BacklogCap))
199 > if decision.NoChange ||
200 > decision.NewTarget == int(sm.scaleState.GetTarget()) &&
201 > backlogCapC8 == number.Compact8(sm.scaleState.GetBacklogCap()) {
202 return
203 }
go.temporal.io/server/service/matching/partition_scaler_mock.go 14 introduced LOC · 3 ranges

Open complete file

81
82 // OnTasks mocks base method.
83 > func (m *MockPartitionScaler) OnTasks(arg0 PartitionScalerInput) PartitionScalerDecision { partition_scaler_mock.go
84 > m.ctrl.T.Helper()
85 > ret := m.ctrl.Call(m, "OnTasks", arg0)
86 > ret0, _ := ret[0].(PartitionScalerDecision)
87 > return ret0
88 > }
89
90 // OnTasks indicates an expected call of OnTasks.
91 > func (mr *MockPartitionScalerMockRecorder) OnTasks(arg0 any) *gomock.Call { partition_scaler_mock.go
92 > mr.mock.ctrl.T.Helper()
93 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnTasks", reflect.TypeOf((*MockPartitionScaler)(nil).OnTasks), arg0)
94 > }
95
96 // Stop mocks base method.
97 > func (m *MockPartitionScaler) Stop() { partition_scaler_mock.go
98 > m.ctrl.T.Helper()
99 > m.ctrl.Call(m, "Stop")
100 > }
101
102 // Stop indicates an expected call of Stop.
go.temporal.io/server/api/persistence/v1/tasks.pb.go 2 introduced LOC · 1 range

Open complete file

659 }
660
661 > func (x *PartitionScaleState) GetPrivateScalerState() *anypb.Any { tasks.pb.go
662 > if x != nil {
663 return x.PrivateScalerState
664 }