Пример #1
0
func testMustNewStorageCollection(t *testing.T) systemspec.StorageCollection {
	newCollection, err := storage.NewCollection(storage.DefaultCollectionConfig())
	if err != nil {
		t.Fatal("expected", nil, "got", err)
	}

	return newCollection
}
Пример #2
0
func newStorageCollection(newLog spec.Log, flags Flags) (spec.StorageCollection, error) {
	newFeatureStorage, err := newConfiguredStorage(newLog, flags.Storage, flags.RedisStoragePrefix, flags.RedisFeatureStorageAddr)
	if err != nil {
		return nil, maskAny(err)
	}
	newGeneralStorage, err := newConfiguredStorage(newLog, flags.Storage, flags.RedisStoragePrefix, flags.RedisGeneralStorageAddr)
	if err != nil {
		return nil, maskAny(err)
	}

	newCollectionConfig := storage.DefaultCollectionConfig()
	newCollectionConfig.FeatureStorage = newFeatureStorage
	newCollectionConfig.GeneralStorage = newGeneralStorage
	newCollection, err := storage.NewCollection(newCollectionConfig)
	if err != nil {
		return nil, maskAny(err)
	}

	return newCollection, nil
}
Пример #3
0
func testMustNewStorageCollectionWithConn(t *testing.T, c redigo.Conn) systemspec.StorageCollection {
	newFeatureStorage, err := redis.NewStorage(redis.DefaultStorageConfigWithConn(c))
	if err != nil {
		t.Fatal("expected", nil, "got", err)
	}

	newGeneralStorage, err := redis.NewStorage(redis.DefaultStorageConfigWithConn(c))
	if err != nil {
		t.Fatal("expected", nil, "got", err)
	}

	newStorageCollectionConfig := storage.DefaultCollectionConfig()
	newStorageCollectionConfig.FeatureStorage = newFeatureStorage
	newStorageCollectionConfig.GeneralStorage = newGeneralStorage
	newStorageCollection, err := storage.NewCollection(newStorageCollectionConfig)
	if err != nil {
		t.Fatal("expected", nil, "got", err)
	}

	return newStorageCollection
}