MCPcopy
hub / github.com/wavetermdev/waveterm / getMatchingRouteIds

Method getMatchingRouteIds

pkg/wps/wps.go:251–280  ·  view source on GitHub ↗
(event WaveEvent)

Source from the content-addressed store, hash-verified

249}
250
251func (b *BrokerType) getMatchingRouteIds(event WaveEvent) []string {
252 b.Lock.Lock()
253 defer b.Lock.Unlock()
254 bs := b.SubMap[event.Event]
255 if bs == nil {
256 return nil
257 }
258 routeIds := make(map[string]bool)
259 for _, routeId := range bs.AllSubs {
260 routeIds[routeId] = true
261 }
262 for _, scope := range event.Scopes {
263 for _, routeId := range bs.ScopeSubs[scope] {
264 routeIds[routeId] = true
265 }
266 for starScope := range bs.StarSubs {
267 if utilfn.StarMatchString(starScope, scope, ":") {
268 for _, routeId := range bs.StarSubs[starScope] {
269 routeIds[routeId] = true
270 }
271 }
272 }
273 }
274 var rtn []string
275 for routeId := range routeIds {
276 rtn = append(rtn, routeId)
277 }
278 // log.Printf("getMatchingRouteIds %v %v\n", event, rtn)
279 return rtn
280}

Callers 1

PublishMethod · 0.95

Calls 1

StarMatchStringFunction · 0.92

Tested by

no test coverage detected