2020-02-17 16:57:15 -05:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
2021-12-03 22:50:58 -05:00
|
|
|
"zotregistry.io/zot/errors"
|
|
|
|
zlog "zotregistry.io/zot/pkg/log"
|
2022-11-02 17:53:08 -05:00
|
|
|
"zotregistry.io/zot/pkg/storage/cache"
|
2020-02-17 16:57:15 -05:00
|
|
|
)
|
|
|
|
|
2022-11-02 17:53:08 -05:00
|
|
|
func Create(dbtype string, parameters interface{}, log zlog.Logger) (cache.Cache, error) {
|
|
|
|
switch dbtype {
|
|
|
|
case "boltdb":
|
|
|
|
{
|
|
|
|
return cache.NewBoltDBCache(parameters, log), nil
|
2020-02-17 16:57:15 -05:00
|
|
|
}
|
2022-11-22 13:29:57 -05:00
|
|
|
case "dynamodb":
|
|
|
|
{
|
|
|
|
return cache.NewDynamoDBCache(parameters, log), nil
|
|
|
|
}
|
2022-11-02 17:53:08 -05:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
return nil, errors.ErrBadConfig
|
2022-04-12 05:01:04 -05:00
|
|
|
}
|
2020-05-27 16:27:35 -05:00
|
|
|
}
|
2020-02-17 16:57:15 -05:00
|
|
|
}
|