connections.go ×4

Frontier kind: Code frontier

unlabeled · c_98415927a48c

28 tests · 1703 LOC · 70 files · introduces 0 tests · 43 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges43 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
213 ranges1703 lines · 70 files · Browse complete extent
All tests (intent)
28 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 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/client/history/connections.go 26 introduced LOC · 4 ranges

Open complete file

56 logger log.Logger,
57 connectionCloseDelay dynamicconfig.DurationPropertyFn,
58 > ) *connectionPoolImpl[C] { connections.go
59 > conns := &sync.Map{}
60 >
61 > c := &connectionPoolImpl[C]{
62 > conns: conns,
63 > historyServiceResolver: historyServiceResolver,
64 > rpcFactory: rpcFactory,
65 > clientCtor: clientCtor,
66 > logger: logger,
67 > connectionCloseDelay: connectionCloseDelay,
68 > }
69 >
70 > // Close cached conns whose host leaves the membership ring.
71 > c.watcher = goro.NewHandle(context.Background()).Go(c.watchMembership)
72 > return c
73 > }
74
75 // Close stops the watcher and closes all pooled connections.
90 }
91
92 > func (c *connectionPoolImpl[C]) watchMembership(ctx context.Context) error { connections.go
93 > listenerName := fmt.Sprintf("%p", c.conns)
94 > ch := make(chan *membership.ChangedEvent, 1)
95 > if err := c.historyServiceResolver.AddListener(listenerName, ch); err != nil {
96 c.logger.Error("Failed to subscribe history connection pool to membership", tag.Error(err))
97 return err
98 }
99 > defer func() { _ = c.historyServiceResolver.RemoveListener(listenerName) }() connections.go
100
101 // Reap departed hosts via a per-address deadline checked by a single ticker;
102 // a re-add resets it to the latest removal.
103 > evictAt := make(map[rpcAddress]time.Time) connections.go
104 > ticker := time.NewTicker(evictionCheckInterval)
105 > defer ticker.Stop()
106 > for {
107 > select {
108 case <-ctx.Done():
109 return nil
go.temporal.io/server/client/history/client.go 17 introduced LOC · 3 ranges

Open complete file

52 rpcFactory RPCFactory,
53 timeout time.Duration,
54 > ) historyservice.HistoryServiceClient { client.go
55 > connections := NewConnectionPool(historyServiceResolver, rpcFactory, historyservice.NewHistoryServiceClient, logger, dynamicconfig.HistoryConnectionCloseDelay.Get(dc))
56 >
57 > var redirector Redirector[historyservice.HistoryServiceClient]
58 > if dynamicconfig.HistoryClientOwnershipCachingEnabled.Get(dc)() {
59 logger.Info("historyClient: ownership caching enabled")
60 redirector = NewCachingRedirector(
64 dynamicconfig.HistoryClientOwnershipCachingStaleTTL.Get(dc),
65 )
66 > } else { client.go
67 > logger.Info("historyClient: ownership caching disabled")
68 > redirector = NewBasicRedirector(connections, historyServiceResolver)
69 > }
70
71 > return &clientImpl{ client.go
72 > connections: connections,
73 > logger: logger,
74 > numberOfShards: numberOfShards,
75 > redirector: redirector,
76 > timeout: timeout,
77 > tokenSerializer: tasktoken.NewSerializer(),
78 > }
79 }
80