Пример #1
0
func NewManager(sources []source_api.Source, sinkManager sinks.ExternalSinkManager, res, bufferDuration time.Duration, useModel bool, modelRes time.Duration, align bool) (Manager, error) {
	// TimeStore constructor passed to the cluster implementation.
	tsConstructor := func() store.TimeStore {
		// TODO(afein): determine default analogy of cache duration to Timestore durations.
		return store.NewGCStore(store.NewCMAStore(), 5*bufferDuration)
	}
	var newCluster model.Cluster = nil
	if useModel {
		newCluster = model.NewCluster(tsConstructor, modelRes)
	}
	firstSync := time.Now()
	if align {
		firstSync = firstSync.Truncate(res).Add(res)
	}
	return &realManager{
		sources:     sources,
		sinkManager: sinkManager,
		cache:       cache.NewCache(bufferDuration),
		model:       newCluster,
		lastSync:    firstSync,
		resolution:  res,
		align:       align,
		decoder:     sink_api.NewDecoder(),
	}, nil
}
Пример #2
0
func NewManager(sources []source_api.Source, sinkManager sinks.ExternalSinkManager, res, bufferDuration time.Duration) (Manager, error) {
	return &realManager{
		sources:     sources,
		sinkManager: sinkManager,
		cache:       cache.NewCache(bufferDuration),
		lastSync:    time.Now(),
		resolution:  res,
		decoder:     sink_api.NewDecoder(),
	}, nil
}