예제 #1
0
func NewSpooler(pipeline *core.Pipeline, config *core.GeneralConfig, publisher_imp *publisher.Publisher) *Spooler {
	ret := &Spooler{
		config: config,
		spool:  make([]*core.EventDescriptor, 0, config.SpoolSize),
		input:  make(chan *core.EventDescriptor, 16), // TODO: Make configurable?
		output: publisher_imp.Connect(),
	}

	pipeline.Register(ret)

	return ret
}
예제 #2
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
}
예제 #3
0
func NewListener(pipeline *core.Pipeline, config *core.GeneralConfig) (*Listener, error) {
	var err error

	ret := &Listener{
		config:          config,
		command_chan:    make(chan string),
		response_chan:   make(chan *Response),
		client_shutdown: make(chan interface{}),
		// TODO: Make this limit configurable
		client_started: make(chan interface{}, 50),
		client_ended:   make(chan interface{}, 50),
	}

	if ret.listener, err = ret.startListening(config); err != nil {
		return nil, err
	}

	pipeline.Register(ret)

	return ret, nil
}
예제 #4
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
}