stream_receiver_monitor.go ×7

Frontier kind: Joint frontier

unlabeled · c_4a8653563872

1 test · 3291 LOC · 146 files · introduces 1 test · 53 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges53 lines · 3 files
Tests
1 test

Contains — complete concept membership

All code (extent)
444 ranges3291 lines · 146 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

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

go.temporal.io/server/service/history/replication/stream_receiver_monitor.go 38 introduced LOC · 7 ranges

Open complete file

369 }
370
371 > func (m *StreamReceiverMonitorImpl) generateStatusMap(inboundKeys map[ClusterShardKeyPair]struct{}) map[ClusterShardKeyPair]*streamStatus { stream_receiver_monitor.go
372 > serverToClients := make(map[ClusterShardKey][]ClusterShardKey)
373 > for keyPair := range inboundKeys {
374 > serverToClients[keyPair.Server] = append(serverToClients[keyPair.Server], keyPair.Client)
375 > }
376 > statusMap := make(map[ClusterShardKeyPair]*streamStatus)
377 > for serverKey, clientKeys := range serverToClients {
378 > m.fillStatusMap(statusMap, serverKey, clientKeys)
379 > }
380 > return statusMap
381 }
382
383 > func (m *StreamReceiverMonitorImpl) fillStatusMap(statusMap map[ClusterShardKeyPair]*streamStatus, serverKey ClusterShardKey, clientsKeys []ClusterShardKey) { stream_receiver_monitor.go
384 > shardContext, err := m.ShardController.GetShardByID(serverKey.ShardID)
385 > if err != nil {
386 m.Logger.Error("Failed to get shardContext.", tag.Error(err))
387 return
388 }
389 > ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) stream_receiver_monitor.go
390 > defer cancel()
391 > engine, err := shardContext.GetEngine(ctx)
392 > if err != nil {
393 m.Logger.Error("Failed to get engine.", tag.Error(err))
394 return
395 }
396 > maxTaskId, _ := engine.GetMaxReplicationTaskInfo() stream_receiver_monitor.go
397 > queueState, ok := shardContext.GetQueueState(tasks.CategoryReplication)
398 > if !ok {
399 m.Logger.Error("Failed to get queue state.")
400 return
401 }
402 > readerStates := queueState.GetReaderStates() stream_receiver_monitor.go
403 > for _, clientKey := range clientsKeys {
404 > readerID := shard.ReplicationReaderIDFromClusterShardID(
405 > int64(clientKey.ClusterID),
406 > clientKey.ShardID,
407 > )
408 > readerState, ok := readerStates[readerID]
409 > if !ok {
410 m.Logger.Error("Failed to get reader state.")
411 statusMap[ClusterShardKeyPair{Client: clientKey, Server: serverKey}] = &streamStatus{
415 continue
416 }
417 > if len(readerState.Scopes) == 3 { stream_receiver_monitor.go
418 statusMap[ClusterShardKeyPair{Client: clientKey, Server: serverKey}] = &streamStatus{
419 defaultAckLevel: readerState.Scopes[0].Range.InclusiveMin.TaskId,
423 isTieredStackEnabled: true,
424 }
425 > } else if len(readerState.Scopes) == 1 { stream_receiver_monitor.go
426 > statusMap[ClusterShardKeyPair{Client: clientKey, Server: serverKey}] = &streamStatus{
427 > defaultAckLevel: readerState.Scopes[0].Range.InclusiveMin.TaskId,
428 > highPriorityAckLevel: 0,
429 > lowPriorityAckLevel: 0,
430 > maxReplicationTaskId: maxTaskId,
431 > isTieredStackEnabled: false,
432 > }
433 > }
434 }
435 }
go.temporal.io/server/service/history/interfaces/engine_mock.go 11 introduced LOC · 2 ranges

Open complete file

206
207 // GetMaxReplicationTaskInfo mocks base method.
208 > func (m *MockEngine) GetMaxReplicationTaskInfo() (int64, time.Time) { engine_mock.go
209 > m.ctrl.T.Helper()
210 > ret := m.ctrl.Call(m, "GetMaxReplicationTaskInfo")
211 > ret0, _ := ret[0].(int64)
212 > ret1, _ := ret[1].(time.Time)
213 > return ret0, ret1
214 > }
215
216 // GetMaxReplicationTaskInfo indicates an expected call of GetMaxReplicationTaskInfo.
217 > func (mr *MockEngineMockRecorder) GetMaxReplicationTaskInfo() *gomock.Call { engine_mock.go
218 > mr.mock.ctrl.T.Helper()
219 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMaxReplicationTaskInfo", reflect.TypeOf((*MockEngine)(nil).GetMaxReplicationTaskInfo))
220 > }
221
222 // GetMutableState mocks base method.
go.temporal.io/server/api/persistence/v1/queues.pb.go 4 introduced LOC · 1 range

Open complete file

115 }
116
117 > func (x *QueueState) GetReaderStates() map[int64]*QueueReaderState { queues.pb.go
118 > if x != nil {
119 > return x.ReaderStates
120 > }
121 return nil
122 }