mirror of
https://github.com/containers/podman.git
synced 2025-12-01 18:49:18 +08:00
vendor latest c/common
Includes the default db backend changes. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
17
vendor/github.com/containers/common/pkg/config/db_backend.go
generated
vendored
17
vendor/github.com/containers/common/pkg/config/db_backend.go
generated
vendored
@@ -13,6 +13,12 @@ const (
|
||||
// SQLite backend.
|
||||
DBBackendSQLite
|
||||
|
||||
// DBBackendDefault describes that no explicit backend has been set.
|
||||
// It should default to sqlite unless there is already an existing boltdb,
|
||||
// this allows for backwards compatibility on upgrades. The actual detection
|
||||
// logic must live in podman as we only know there were to look for the file.
|
||||
DBBackendDefault
|
||||
|
||||
stringBoltDB = "boltdb"
|
||||
stringSQLite = "sqlite"
|
||||
)
|
||||
@@ -24,6 +30,8 @@ func (d DBBackend) String() string {
|
||||
return stringBoltDB
|
||||
case DBBackendSQLite:
|
||||
return stringSQLite
|
||||
case DBBackendDefault:
|
||||
return ""
|
||||
default:
|
||||
return fmt.Sprintf("unsupported database backend: %d", d)
|
||||
}
|
||||
@@ -32,7 +40,7 @@ func (d DBBackend) String() string {
|
||||
// Validate returns whether the DBBackend is supported.
|
||||
func (d DBBackend) Validate() error {
|
||||
switch d {
|
||||
case DBBackendBoltDB, DBBackendSQLite:
|
||||
case DBBackendBoltDB, DBBackendSQLite, DBBackendDefault:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("unsupported database backend: %d", d)
|
||||
@@ -49,12 +57,9 @@ func ParseDBBackend(raw string) (DBBackend, error) {
|
||||
return DBBackendBoltDB, nil
|
||||
case stringSQLite:
|
||||
return DBBackendSQLite, nil
|
||||
case "":
|
||||
return DBBackendDefault, nil
|
||||
default:
|
||||
return DBBackendUnsupported, fmt.Errorf("unsupported database backend: %q", raw)
|
||||
}
|
||||
}
|
||||
|
||||
// DBBackend returns the configured database backend.
|
||||
func (c *Config) DBBackend() (DBBackend, error) {
|
||||
return ParseDBBackend(c.Engine.DBBackend)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user