func (c *appServiceCache) Remove(appService appservice.AppService) { c.Lock() defer c.Unlock() appCache := c.appServicesByAppId[appService.AppId] delete(appCache, appService.Id()) if len(appCache) == 0 { delete(c.appServicesByAppId, appService.AppId) } }
func (c *appServiceCache) Exists(appService appservice.AppService) bool { c.RLock() defer c.RUnlock() serviceExists := false appServices, appExists := c.appServicesByAppId[appService.AppId] if appExists { _, serviceExists = appServices[appService.Id()] } return serviceExists }
func (c *appServiceCache) Add(appService appservice.AppService) { c.Lock() defer c.Unlock() appServicesById, ok := c.appServicesByAppId[appService.AppId] if !ok { appServicesById = make(map[string]appservice.AppService) c.appServicesByAppId[appService.AppId] = appServicesById } appServicesById[appService.Id()] = appService }
func key(service appservice.AppService) string { return path.Join("/loggregator/services", service.AppId, service.Id()) }
func buildNode(appService appservice.AppService) storeadapter.StoreNode { return storeadapter.StoreNode{ Key: path.Join("/loggregator/services", appService.AppId, appService.Id()), Value: []byte(appService.Url), } }