MCPcopy
hub / github.com/go-kit/kit / NewEndpointer

Function NewEndpointer

sd/endpointer.go:28–41  ·  view source on GitHub ↗

NewEndpointer creates an Endpointer that subscribes to updates from Instancer src and uses factory f to create Endpoints. If src notifies of an error, the Endpointer keeps returning previously created Endpoints assuming they are still good, unless this behavior is disabled via InvalidateOnError opti

(src Instancer, f Factory, logger log.Logger, options ...EndpointerOption)

Source from the content-addressed store, hash-verified

26// keeps returning previously created Endpoints assuming they are still good, unless
27// this behavior is disabled via InvalidateOnError option.
28func NewEndpointer(src Instancer, f Factory, logger log.Logger, options ...EndpointerOption) *DefaultEndpointer {
29 opts := endpointerOptions{}
30 for _, opt := range options {
31 opt(&opts)
32 }
33 se := &DefaultEndpointer{
34 cache: newEndpointCache(f, logger, opts),
35 instancer: src,
36 ch: make(chan Event),
37 }
38 go se.receive()
39 src.Register(se.ch)
40 return se
41}
42
43// EndpointerOption allows control of endpointCache behavior.
44type EndpointerOption func(*endpointerOptions)

Callers 10

TestDefaultEndpointerFunction · 0.92
ExampleFunction · 0.92
TestIntegrationFunction · 0.92
TestIntegrationFunction · 0.92
TestDataRaceFunction · 0.92
TestInstancerFunction · 0.92
TestBadFactoryFunction · 0.92
TestServiceUpdateFunction · 0.92
ExampleFunction · 0.92
runIntegrationFunction · 0.92

Calls 3

receiveMethod · 0.95
newEndpointCacheFunction · 0.85
RegisterMethod · 0.65

Tested by 10

TestDefaultEndpointerFunction · 0.74
ExampleFunction · 0.74
TestIntegrationFunction · 0.74
TestIntegrationFunction · 0.74
TestDataRaceFunction · 0.74
TestInstancerFunction · 0.74
TestBadFactoryFunction · 0.74
TestServiceUpdateFunction · 0.74
ExampleFunction · 0.74
runIntegrationFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…