pernamespaceworker.go ×6

Frontier kind: Code frontier

unlabeled · c_35b8e499281c

26 tests · 2965 LOC · 154 files · introduces 0 tests · 57 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges57 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
452 ranges2965 lines · 154 files · Browse complete extent
All tests (intent)
26 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: 57 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/pernamespaceworker.go 45 introduced LOC · 6 ranges

Open complete file

112 components []workercommon.PerNSWorkerComponent,
113 taskQueueName string,
114 > ) *PerNamespaceWorkerManager { pernamespaceworker.go
115 > return &PerNamespaceWorkerManager{
116 > logger: log.With(logger, tag.ComponentPerNSWorkerManager),
117 > sdkClientFactory: sdkClientFactory,
118 > namespaceRegistry: namespaceRegistry,
119 > hostName: hostName,
120 > taskQueueName: taskQueueName,
121 > config: config,
122 > components: components,
123 > initialRetry: 1 * time.Second,
124 > thisClusterName: clusterMetadata.GetCurrentClusterName(),
125 > startLimiter: quotas.NewDefaultOutgoingRateLimiter(quotas.RateFn(config.PerNamespaceWorkerStartRate)),
126 > membershipChangedCh: make(chan *membership.ChangedEvent),
127 > workers: make(map[namespace.ID]*perNamespaceWorker),
128 > }
129 > }
130
131 func (wm *PerNamespaceWorkerManager) Running() bool {
136 self membership.HostInfo,
137 serviceResolver membership.ServiceResolver,
139 > if !atomic.CompareAndSwapInt32(
140 > &wm.status,
141 > common.DaemonStatusInitialized,
142 > common.DaemonStatusStarted,
143 > ) {
144 return
145 }
146
147 > wm.self = self pernamespaceworker.go
148 > wm.serviceResolver = serviceResolver
149 >
150 > wm.logger.Info("", tag.LifeCycleStarting)
151 >
152 > // this will call namespaceCallback with current namespaces
153 > wm.namespaceRegistry.RegisterStateChangeCallback(wm, wm.namespaceCallback)
154 >
155 > err := wm.serviceResolver.AddListener(fmt.Sprintf("%p", wm), wm.membershipChangedCh)
156 > if err != nil {
157 wm.logger.Fatal("Unable to register membership listener", tag.Error(err))
158 }
159 > wm.backgroundLoops.Go(wm.membershipChangedListener) pernamespaceworker.go
160 > wm.backgroundLoops.Go(wm.periodicRefreshLoop)
161 >
162 > wm.logger.Info("", tag.LifeCycleStarted)
163 }
164
207 }
208
209 > func (wm *PerNamespaceWorkerManager) membershipChangedListener(ctx context.Context) error { pernamespaceworker.go
210 > for {
211 > select {
212 case <-ctx.Done():
213 return nil
218 }
219
220 > func (wm *PerNamespaceWorkerManager) periodicRefreshLoop(ctx context.Context) error { pernamespaceworker.go
221 > ticker := time.NewTicker(refreshInterval)
222 > defer ticker.Stop()
223 >
224 > for {
225 > select {
226 case <-ctx.Done():
227 return nil
go.temporal.io/server/service/worker/fx.go 12 introduced LOC · 1 range

Open complete file

210 }
211
212 > func PerNamespaceWorkerManagerProvider(params perNamespaceWorkerManagerInitParams) *PerNamespaceWorkerManager { fx.go
213 > return NewPerNamespaceWorkerManager(
214 > params.Logger,
215 > params.SdkClientFactory,
216 > params.NamespaceRegistry,
217 > params.HostName,
218 > params.Config,
219 > params.ClusterMetadata,
220 > params.Components,
221 > primitives.PerNSWorkerTaskQueue,
222 > )
223 > }
224
225 func ServerProvider(rpcFactory common.RPCFactory, logger log.Logger) *grpc.Server {