代码拉取完成,页面将自动刷新
package harvester
import (
"errors"
"github.com/elastic/beats/filebeat/util"
"github.com/elastic/beats/libbeat/logp"
)
// Outlet interface is used for forwarding events
type Outlet interface {
OnEvent(data *util.Data) bool
}
// Forwarder contains shared options between all harvesters needed to forward events
type Forwarder struct {
Outlet Outlet
}
// ForwarderConfig contains all config options shared by all harvesters
type ForwarderConfig struct {
Type string `config:"type"`
}
// NewForwarder creates a new forwarder instances and initialises processors if configured
func NewForwarder(outlet Outlet) *Forwarder {
return &Forwarder{Outlet: outlet}
}
// Send updates the prospector state and sends the event to the spooler
// All state updates done by the prospector itself are synchronous to make sure no states are overwritten
func (f *Forwarder) Send(data *util.Data) error {
ok := f.Outlet.OnEvent(data)
if !ok {
logp.Info("Prospector outlet closed")
return errors.New("prospector outlet closed")
}
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。