当前位置: 首页>>代码示例>>Golang>>正文


Golang AppService.Id方法代码示例

本文整理汇总了Golang中loggregator/domain.AppService.Id方法的典型用法代码示例。如果您正苦于以下问题:Golang AppService.Id方法的具体用法?Golang AppService.Id怎么用?Golang AppService.Id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在loggregator/domain.AppService的用法示例。


在下文中一共展示了AppService.Id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Remove

func (cache AppServiceCache) Remove(appService domain.AppService) {
	appCache := cache.appServicesByAppId[appService.AppId]
	delete(appCache, appService.Id())
	if len(appCache) == 0 {
		delete(cache.appServicesByAppId, appService.AppId)
	}
}
开发者ID:james-masson,项目名称:loggregator,代码行数:7,代码来源:app_service_cache.go

示例2: Exists

func (cache AppServiceCache) Exists(appService domain.AppService) bool {
	serviceExists := false
	appServices, appExists := cache.appServicesByAppId[appService.AppId]
	if appExists {
		_, serviceExists = appServices[appService.Id()]
	}
	return serviceExists
}
开发者ID:james-masson,项目名称:loggregator,代码行数:8,代码来源:app_service_cache.go

示例3: Add

func (cache AppServiceCache) Add(appService domain.AppService) {
	appServicesById, ok := cache.appServicesByAppId[appService.AppId]
	if !ok {
		appServicesById = make(map[string]domain.AppService)
		cache.appServicesByAppId[appService.AppId] = appServicesById
	}

	appServicesById[appService.Id()] = appService
}
开发者ID:james-masson,项目名称:loggregator,代码行数:9,代码来源:app_service_cache.go

示例4:

				})
			})
		})

		Context("When an existing service is updated", func() {
			It("should not notify the channel again", func() {
				adapter.SetMulti([]storeadapter.StoreNode{buildNode(app2Service1)})
				assertNoDataOnChannel(outAddChan)
				assertNoDataOnChannel(outRemoveChan)
			})
		})

		Context("when a service or app should be removed", func() {
			Context("when an existing app loses one of its services", func() {
				It("sends that service on the output remove channel", func(done Done) {
					adapter.Delete(path.Join("/loggregator/services", app1Service2.AppId, app1Service2.Id()))

					Expect(<-outRemoveChan).To(Equal(app1Service2))
					assertNoDataOnChannel(outAddChan)

					close(done)
				})
			})

			Context("when an existing app loses all of its services", func() {
				It("sends all of the app services on the outgoing remove channel", func(done Done) {
					adapter.Delete(path.Join("/loggregator/services", app1Service2.AppId))

					appServices := drainOutgoingChannel(outRemoveChan, 2)

					Expect(appServices).To(ContainElement(app1Service1))
开发者ID:james-masson,项目名称:loggregator,代码行数:31,代码来源:app_service_store_watcher_test.go


注:本文中的loggregator/domain.AppService.Id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。