Ejemplo n.º 1
0
func testStoreAndQueryExecutor() (*tsdb.Store, *tsdb.QueryExecutor) {
	store := testStore()
	database := "foo"
	retentionPolicy := "bar"
	store.CreateShard(database, retentionPolicy, sID0)
	store.CreateShard(database, retentionPolicy, sID1)

	query_executor := tsdb.NewQueryExecutor(store)
	query_executor.ShardMapper = &testQEShardMapper{store}

	return store, query_executor
}
Ejemplo n.º 2
0
func testStoreAndExecutor(storePath string) (*tsdb.Store, *tsdb.QueryExecutor) {
	if storePath == "" {
		storePath, _ = ioutil.TempDir("", "")
	}

	store := tsdb.NewStore(storePath)
	store.EngineOptions.Config.WALDir = filepath.Join(storePath, "wal")

	err := store.Open()
	if err != nil {
		panic(err)
	}
	database := "foo"
	retentionPolicy := "bar"
	shardID := uint64(1)
	store.CreateShard(database, retentionPolicy, shardID)

	executor := tsdb.NewQueryExecutor(store)
	executor.MetaStore = &testMetastore{}
	executor.ShardMapper = &testShardMapper{store: store}

	return store, executor
}