scale_manager.go ×5

Frontier kind: Code frontier

unlabeled · c_422a2a935e8d

36 tests · 2759 LOC · 139 files · introduces 0 tests · 43 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges43 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
425 ranges2759 lines · 139 files · Browse complete extent
All tests (intent)
36 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: 43 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/scale_manager.go 38 introduced LOC · 5 ranges

Open complete file

76 getWritePartitions dynamicconfig.IntPropertyFn,
77 emitGaugeMetrics dynamicconfig.BoolPropertyFn,
78 > ) *scaleManager { scale_manager.go
79 > return &scaleManager{
80 > partition: partition,
81 > logger: log.With(logger, tag.ComponentPartitionScaler),
82 > metricsHandler: metricsHandler,
83 > userDataManager: userDataManager,
84 > matchingClient: matchingClient,
85 > partitionScaler: partitionScaler,
86 > batchSize: int64(settings().BatchSize),
87 > settings: settings,
88 > getWritePartitions: getWritePartitions,
89 > emitGaugeMetrics: emitGaugeMetrics,
90 > timeSource: timeSource,
91 > background: goro.NewHandle(baseCtx),
92 > wakeup: make(chan struct{}, 1),
93 > }
94 > }
95
96 func (sm *scaleManager) Stop() {
115 }
116 // backgroundWork can assume sm.scaleDB is set since we set it before starting it.
117 > sm.scaleDB = scaleDB scale_manager.go
118 > sm.setState(scaleState, sm.settings())
119 > sm.background.Go(sm.backgroundWork)
120 }
121
140 }
141
142 > func (sm *scaleManager) backgroundWork(ctx context.Context) error { scale_manager.go
143 > timerCh := func() <-chan time.Time {
144 > ch, _ := sm.timeSource.NewTimer(backoff.Jitter(sm.settings().BackgroundInterval, 0.05))
145 > return ch
146 > }
147 > ch := timerCh()
148 > for {
149 > select {
150 case <-ctx.Done():
151 return ctx.Err()
290 // This should only be called _after_ the state is persisted to the db.
291 // Called from backgroundWork or LoadedMetadata only.
292 > func (sm *scaleManager) setState(newState *persistencespb.PartitionScaleState, settings dynamicconfig.PartitionScaleManagerSettings) { scale_manager.go
293 > prevInfo := scaleStateToInfo(sm.scaleState, settings)
294 >
295 > sm.scaleState = newState
296 >
297 > newInfo := scaleStateToInfo(sm.scaleState, settings)
298 >
299 > // only push ephemeral data if _info_ changed, not on any state change
300 > if !proto.Equal(prevInfo, newInfo) {
301 sm.userDataManager.SetPartitionScale(newInfo)
302 }
303
304 > if sm.emitGaugeMetrics() { scale_manager.go
305 metrics.PartitionScaleRead.With(sm.metricsHandler).Record(float64(newInfo.Read))
306 metrics.PartitionScaleWrite.With(sm.metricsHandler).Record(float64(newInfo.Write))
go.temporal.io/server/api/taskqueue/v1/message.pb.go 5 introduced LOC · 1 range

Open complete file

935 mi := &file_temporal_server_api_taskqueue_v1_message_proto_msgTypes[11]
936 if x != nil {
937 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) message.pb.go
938 > if ms.LoadMessageInfo() == nil {
939 > ms.StoreMessageInfo(mi)
940 > }
941 > return ms
942 }
943 return mi.MessageOf(x)