service_resolver.go ×8

Frontier kind: Code frontier

unlabeled · c_8794c7829ff8

12 tests · 2378 LOC · 86 files · introduces 0 tests · 20 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges20 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
389 ranges2378 lines · 86 files · Browse complete extent
All tests (intent)
12 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.

1 file ranked by introduced lines: 20 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/membership/ringpop/service_resolver.go 20 introduced LOC · 8 ranges

Open complete file

158
159 // Lookup finds the host in the ring responsible for serving the given key
160 > func (r *serviceResolver) Lookup(key string) (membership.HostInfo, error) { service_resolver.go
161 > ring, hosts := r.ring()
162 > addr, found := ring.Lookup(key)
163 > if !found {
164 r.RequestRefresh()
165 return nil, membership.ErrInsufficientHosts
166 }
167 > return hosts[addr], nil service_resolver.go
168 }
169
170 > func (r *serviceResolver) LookupN(key string, n int) []membership.HostInfo { service_resolver.go
171 > if n <= 0 {
172 return nil
173 }
174 > ring, hosts := r.ring() service_resolver.go
175 > addrs := ring.LookupN(key, n)
176 > if len(addrs) == 0 {
177 r.RequestRefresh()
178 return nil
179 }
180 > return util.MapSlice(addrs, func(addr string) membership.HostInfo { return hosts[addr] }) service_resolver.go
181 }
182
184 name string,
185 notifyChannel chan<- *membership.ChangedEvent,
186 > ) error { service_resolver.go
187 > r.listenerLock.Lock()
188 > defer r.listenerLock.Unlock()
189 > _, ok := r.listeners[name]
190 > if ok {
191 return membership.ErrListenerAlreadyExist
192 }
193 > r.listeners[name] = notifyChannel service_resolver.go
194 > return nil
195 }
196
410
411 for name, ch := range r.listeners {
412 > select { service_resolver.go
413 > case ch <- event:
414 default:
415 r.logger.Error("Failed to send listener notification, channel full", tag.ListenerName(name))