milvus/storage/pkg/storage.go
shengjh 6554b2cf16 Fix bug for s3 storage
Signed-off-by: shengjh <1572099106@qq.com>
2020-09-25 16:12:33 +08:00

38 lines
902 B
Go

package storage
import (
"context"
"errors"
S3Driver "github.com/czs007/suvlim/storage/internal/S3"
minIODriver "github.com/czs007/suvlim/storage/internal/minio"
tikvDriver "github.com/czs007/suvlim/storage/internal/tikv"
"github.com/czs007/suvlim/storage/pkg/types"
)
func NewStore(ctx context.Context, driver types.DriverType) (types.Store, error) {
var err error
var store types.Store
switch driver{
case types.TIKVDriver:
store, err = tikvDriver.NewTikvStore(ctx)
if err != nil {
panic(err.Error())
}
return store, nil
case types.MinIODriver:
store, err = minIODriver.NewMinioDriver(ctx)
if err != nil {
//panic(err.Error())
return nil, err
}
return store, nil
case types.S3DRIVER:
store , err = S3Driver.NewS3Driver(ctx)
if err != nil {
//panic(err.Error())
return nil, err
}
return store, nil
}
return nil, errors.New("unsupported driver")
}