App returns a list of all cluster members for the given ARI Application whose LastActive time is no older than the given maxAge.
(app string, maxAge time.Duration)
| 74 | |
| 75 | // App returns a list of all cluster members for the given ARI Application whose LastActive time is no older than the given maxAge. |
| 76 | func (c *Cluster) App(app string, maxAge time.Duration) (list []Member) { |
| 77 | c.mu.Lock() |
| 78 | defer c.mu.Unlock() |
| 79 | |
| 80 | for k, v := range c.members { |
| 81 | i, a := dehash(k) |
| 82 | if app == a && (maxAge == 0 || time.Since(v) < maxAge) { |
| 83 | list = append(list, Member{ |
| 84 | ID: i, |
| 85 | App: a, |
| 86 | LastActive: v, |
| 87 | }) |
| 88 | } |
| 89 | } |
| 90 | return |
| 91 | } |
| 92 | |
| 93 | // Matching returns a list of all cluster members for whom the given proxy Metadata matches |
| 94 | func (c *Cluster) Matching(id, app string, maxAge time.Duration) (list []Member) { |