本文整理匯總了Golang中github.com/mozilla-services/heka/logstreamer.MultipleError類的典型用法代碼示例。如果您正苦於以下問題:Golang MultipleError類的具體用法?Golang MultipleError怎麽用?Golang MultipleError使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了MultipleError類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Run
// Main Logstreamer Input runner. This runner kicks off all the other
// logstream inputs, and handles rescanning for updates to the filesystem that
// might affect file visibility for the logstream inputs.
func (li *LogstreamerInput) Run(ir p.InputRunner, h p.PluginHelper) (err error) {
var (
ok bool
errs *ls.MultipleError
newstreams []string
)
// Kick off all the current logstreams we know of
i := 0
for _, logstream := range li.plugins {
i++
li.startLogstreamInput(logstream, i, ir, h)
}
ok = true
rescan := time.Tick(li.rescanInterval)
// Our main rescan loop that handles shutting down
for ok {
select {
case <-li.stopChan:
ok = false
returnChans := make([]chan bool, len(li.stopLogstreamChans))
// Send out all the stop signals
for i, ch := range li.stopLogstreamChans {
ret := make(chan bool)
ch <- ret
returnChans[i] = ret
}
// Wait for all the stops
for _, ch := range returnChans {
<-ch
}
// Close our own stopChan to indicate we shut down
close(li.stopChan)
case <-rescan:
li.logstreamSetLock.Lock()
newstreams, errs = li.logstreamSet.ScanForLogstreams()
if errs.IsError() {
ir.LogError(errs)
}
for _, name := range newstreams {
stream, ok := li.logstreamSet.GetLogstream(name)
if !ok {
ir.LogError(fmt.Errorf("Found new logstream: %s, but couldn't fetch it.",
name))
continue
}
lsi := NewLogstreamInput(stream, name, li.hostName)
li.plugins[name] = lsi
i++
li.startLogstreamInput(lsi, i, ir, h)
}
li.logstreamSetLock.Unlock()
}
}
return nil
}