Ejemplo n.º 1
0
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)
	}
}
Ejemplo n.º 2
0
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
}
Ejemplo n.º 3
0
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())
}
Ejemplo n.º 5
0
func buildNode(appService appservice.AppService) storeadapter.StoreNode {
	return storeadapter.StoreNode{
		Key:   path.Join("/loggregator/services", appService.AppId, appService.Id()),
		Value: []byte(appService.Url),
	}
}