MCPcopy Create free account
hub / github.com/CyCoreSystems/ari-proxy / Matching

Method Matching

client/cluster/cluster.go:94–117  ·  view source on GitHub ↗

Matching returns a list of all cluster members for whom the given proxy Metadata matches

(id, app string, maxAge time.Duration)

Source from the content-addressed store, hash-verified

92
93// Matching returns a list of all cluster members for whom the given proxy Metadata matches
94func (c *Cluster) Matching(id, app string, maxAge time.Duration) (list []Member) {
95 c.mu.Lock()
96 defer c.mu.Unlock()
97
98 for k, v := range c.members {
99 if time.Since(v) > maxAge {
100 continue
101 }
102
103 i, a := dehash(k)
104 if id != "" && id != i {
105 continue
106 }
107 if app != "" && app != a {
108 continue
109 }
110 list = append(list, Member{
111 ID: i,
112 App: a,
113 LastActive: v,
114 })
115 }
116 return
117}
118
119// Update adds (or updates) a proxy to/in the cluster
120func (c *Cluster) Update(id, app string) {

Callers 2

makeRequestsMethod · 0.80

Calls 1

dehashFunction · 0.85

Tested by

no test coverage detected