本文整理汇总了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)
}
}
示例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
}
示例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
}
示例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))