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