Ejemplo n.º 1
0
// NewEngine returns a new instance of Engine.
func NewEngine(path string, walPath string, opt tsdb.EngineOptions) tsdb.Engine {
	// Configure statistics collection.
	key := fmt.Sprintf("engine:%s:%s", opt.EngineVersion, path)
	tags := map[string]string{"path": path, "version": opt.EngineVersion}
	statMap := influxdb.NewStatistics(key, "engine", tags)

	// create the writer with a directory of the same name as the shard, but with the wal extension
	w := wal.NewLog(walPath)

	w.ReadySeriesSize = opt.Config.WALReadySeriesSize
	w.FlushColdInterval = time.Duration(opt.Config.WALFlushColdInterval)
	w.MaxSeriesSize = opt.Config.WALMaxSeriesSize
	w.CompactionThreshold = opt.Config.WALCompactionThreshold
	w.PartitionSizeThreshold = opt.Config.WALPartitionSizeThreshold
	w.ReadySeriesSize = opt.Config.WALReadySeriesSize
	w.LoggingEnabled = opt.Config.WALLoggingEnabled

	e := &Engine{
		path: path,

		statMap:   statMap,
		BlockSize: DefaultBlockSize,
		WAL:       w,
	}

	w.Index = e

	return e
}
Ejemplo n.º 2
0
// NewEngine returns a new instance of Engine.
func NewEngine(path string, opt tsdb.EngineOptions) tsdb.Engine {
	// create the writer with a directory of the same name as the shard, but with the wal extension
	w := wal.NewLog(filepath.Join(opt.Config.WALDir, filepath.Base(path)))

	w.ReadySeriesSize = opt.Config.WALReadySeriesSize
	w.FlushColdInterval = time.Duration(opt.Config.WALFlushColdInterval)
	w.MaxSeriesSize = opt.Config.WALMaxSeriesSize
	w.CompactionThreshold = opt.Config.WALCompactionThreshold
	w.PartitionSizeThreshold = opt.Config.WALPartitionSizeThreshold
	w.ReadySeriesSize = opt.Config.WALReadySeriesSize

	e := &Engine{
		path: path,

		BlockSize: DefaultBlockSize,
		WAL:       w,
	}

	w.Index = e

	return e
}