本文整理匯總了Golang中loggregator/sinks.Sink.AppId方法的典型用法代碼示例。如果您正苦於以下問題:Golang Sink.AppId方法的具體用法?Golang Sink.AppId怎麽用?Golang Sink.AppId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類loggregator/sinks.Sink
的用法示例。
在下文中一共展示了Sink.AppId方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Delete
func (gc *GroupedSinks) Delete(sink sinks.Sink) bool {
gc.Lock()
defer gc.Unlock()
wrapper, ok := gc.apps[sink.AppId()][sink.Identifier()]
if ok {
close(wrapper.inputChan)
delete(gc.apps[sink.AppId()], sink.Identifier())
return true
}
return false
}
示例2: dumpToSink
func (messageRouter *messageRouter) dumpToSink(sink sinks.Sink, activeSinks *groupedsinks.GroupedSinks) {
dumpChan := make(chan *logmessage.Message, 20)
if sink := activeSinks.DumpFor(sink.AppId()); sink != nil {
sink.Dump(dumpChan)
} else {
close(dumpChan)
}
for message := range dumpChan {
sink.Channel() <- message
}
}
示例3: Register
func (gc *GroupedSinks) Register(s sinks.Sink) bool {
gc.Lock()
defer gc.Unlock()
appId := s.AppId()
if appId == "" || s.Identifier() == "" {
return false
}
if gc.apps[appId] == nil {
gc.apps[appId] = make(map[string]sinks.Sink)
}
if gc.apps[appId][s.Identifier()] != nil {
return false
}
gc.apps[appId][s.Identifier()] = s
return true
}
示例4: Register
func (gc *GroupedSinks) Register(in chan<- *logmessage.Message, s sinks.Sink) bool {
gc.Lock()
defer gc.Unlock()
appId := s.AppId()
if appId == "" || s.Identifier() == "" {
return false
}
sinksForApp := gc.apps[appId]
if sinksForApp == nil {
gc.apps[appId] = make(map[string]*sinkWrapper)
sinksForApp = gc.apps[appId]
}
if _, ok := sinksForApp[s.Identifier()]; ok {
return false
}
sinksForApp[s.Identifier()] = &sinkWrapper{inputChan: in, s: s}
return true
}
示例5: Delete
func (gc *GroupedSinks) Delete(sink sinks.Sink) {
gc.Lock()
defer gc.Unlock()
delete(gc.apps[sink.AppId()], sink.Identifier())
}