Esempio n. 1
0
func newStdinRegistrar(pipeline *core.Pipeline) *StdinRegistrar {
	ret := &StdinRegistrar{
		registrar_chan: make(chan []registrar.EventProcessor, 16),
		signal_chan:    make(chan int64, 1),
	}

	ret.group.Add(1)

	pipeline.Register(ret)

	return ret
}
Esempio n. 2
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
}
Esempio n. 3
0
func NewRegistrar(pipeline *core.Pipeline, persistdir string) *Registrar {
	ret := &Registrar{
		registrar_chan: make(chan []EventProcessor, 16), // TODO: Make configurable?
		persistdir:     persistdir,
		statefile:      ".log-courier",
		state:          make(map[core.Stream]*FileState),
	}

	pipeline.Register(ret)

	return ret
}
Esempio n. 4
0
func NewPublisher(pipeline *core.Pipeline, config *core.NetworkConfig, registrar registrar.Registrator) (*Publisher, error) {
	ret := &Publisher{
		config: config,
		input:  make(chan []*core.EventDescriptor, 1),
	}

	if registrar == nil {
		ret.registrar_spool = newNullEventSpool()
	} else {
		ret.registrar_spool = registrar.Connect()
	}

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

	pipeline.Register(ret)

	return ret, nil
}
Esempio n. 5
0
func NewProspector(pipeline *core.Pipeline, config *core.Config, from_beginning bool, registrar_imp registrar.Registrator, spooler_imp *spooler.Spooler) (*Prospector, error) {
	ret := &Prospector{
		config:          config,
		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
}
Esempio n. 6
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.listen(config); err != nil {
		return nil, err
	}

	pipeline.Register(ret)

	return ret, nil
}