Ejemplo n.º 1
0
func TestCompletePipeWithBoltStore(t *testing.T) {
	assert := assert.New(t)
	log.SetLevel(log.ErrorLevel)
	dbPath := "./bolt.db"
	defer os.RemoveAll(dbPath)
	store, err := data.NewBoltStore(dbPath)
	assert.Nil(err)
	assert.NotNil(store)
	test.ExecuteCompletePipe(t, store)
	store.Close()
}
Ejemplo n.º 2
0
func CreateDataStore() {
	dbType := conf.UString("store.type", "memory")
	switch dbType {
	case "memory":
		DataStore = data.NewSimpleInMemoryStore()
	case "bolt":
		storagePath := conf.UString("store.path", "/opt/gluon-collector/collector.db")
		boltStore, err := data.NewBoltStore(storagePath)
		if err != nil {
			log.WithFields(log.Fields{
				"error":     err,
				"storePath": storagePath,
				"storeType": dbType,
			}).Fatal("Can't create bolt store")
		} else {
			Closeables = append(Closeables, boltStore)
			DataStore = boltStore
		}
	default:
		log.Fatalf("Unknown store type %s", dbType)
	}
}