Пример #1
0
func NewPublisher(pipeline *core.Pipeline, config *core.NetworkConfig, registrar_imp *registrar.Registrar) (*Publisher, error) {
	ret := &Publisher{
		config:          config,
		input:           make(chan []*core.EventDescriptor, 1),
		registrar_spool: registrar_imp.Connect(),
	}

	if err := ret.init(); err != nil {
		return nil, err
	}

	pipeline.Register(ret)

	return ret, nil
}
Пример #2
0
func NewProspector(pipeline *core.Pipeline, config *core.Config, from_beginning bool, registrar_imp *registrar.Registrar, spooler_imp *spooler.Spooler) (*Prospector, error) {
	ret := &Prospector{
		generalconfig:   &config.General,
		fileconfigs:     config.Files,
		prospectorindex: make(map[string]*prospectorInfo),
		prospectors:     make(map[*prospectorInfo]*prospectorInfo),
		from_beginning:  from_beginning,
		registrar:       registrar_imp,
		registrar_spool: registrar_imp.Connect(),
		snapshot_chan:   make(chan interface{}),
		snapshot_sink:   make(chan []*core.Snapshot),
		output:          spooler_imp.Connect(),
	}

	if err := ret.init(); err != nil {
		return nil, err
	}

	pipeline.Register(ret)

	return ret, nil
}