mirror of https://github.com/containers/podman.git
Remove current SQLite DB driver
The SQLite DB backend has become an unmanageable nightmare. I like having the option for DB work, but it's become an active hindrance to further development, and it's definitely not in any shape to be actively used. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #548 Approved by: baude
This commit is contained in:
parent
f2894f243b
commit
b18f089545
|
@ -30,6 +30,7 @@ const (
|
||||||
// reboot
|
// reboot
|
||||||
InMemoryStateStore RuntimeStateStore = iota
|
InMemoryStateStore RuntimeStateStore = iota
|
||||||
// SQLiteStateStore is a state backed by a SQLite database
|
// SQLiteStateStore is a state backed by a SQLite database
|
||||||
|
// It is presently disabled
|
||||||
SQLiteStateStore RuntimeStateStore = iota
|
SQLiteStateStore RuntimeStateStore = iota
|
||||||
// BoltDBStateStore is a state backed by a BoltDB database
|
// BoltDBStateStore is a state backed by a BoltDB database
|
||||||
BoltDBStateStore RuntimeStateStore = iota
|
BoltDBStateStore RuntimeStateStore = iota
|
||||||
|
@ -386,23 +387,7 @@ func makeRuntime(runtime *Runtime) error {
|
||||||
}
|
}
|
||||||
runtime.state = state
|
runtime.state = state
|
||||||
case SQLiteStateStore:
|
case SQLiteStateStore:
|
||||||
dbPath := filepath.Join(runtime.config.StaticDir, "sql_state.db")
|
return errors.Wrapf(ErrInvalidArg, "SQLite state is currently disabled")
|
||||||
specsDir := filepath.Join(runtime.config.StaticDir, "ocispec")
|
|
||||||
|
|
||||||
// Make a directory to hold JSON versions of container OCI specs
|
|
||||||
if err := os.MkdirAll(specsDir, 0755); err != nil {
|
|
||||||
// The directory is allowed to exist
|
|
||||||
if !os.IsExist(err) {
|
|
||||||
return errors.Wrapf(err, "error creating runtime OCI specs directory %s",
|
|
||||||
specsDir)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
state, err := NewSQLState(dbPath, specsDir, runtime.lockDir, runtime)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
runtime.state = state
|
|
||||||
case BoltDBStateStore:
|
case BoltDBStateStore:
|
||||||
dbPath := filepath.Join(runtime.config.StaticDir, "bolt_state.db")
|
dbPath := filepath.Join(runtime.config.StaticDir, "bolt_state.db")
|
||||||
|
|
||||||
|
|
1091
libpod/sql_state.go
1091
libpod/sql_state.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -24,7 +24,6 @@ const (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
testedStates = map[string]emptyStateFunc{
|
testedStates = map[string]emptyStateFunc{
|
||||||
"sql": getEmptySQLState,
|
|
||||||
"in-memory": getEmptyInMemoryState,
|
"in-memory": getEmptyInMemoryState,
|
||||||
"boltdb": getEmptyBoltState,
|
"boltdb": getEmptyBoltState,
|
||||||
}
|
}
|
||||||
|
@ -79,35 +78,6 @@ func getEmptyInMemoryState() (s State, p string, p2 string, err error) {
|
||||||
return state, tmpDir, tmpDir, nil
|
return state, tmpDir, tmpDir, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get an empty SQL state for use in tests
|
|
||||||
// An empty Runtime is provided
|
|
||||||
func getEmptySQLState() (s State, p string, p2 string, err error) {
|
|
||||||
tmpDir, err := ioutil.TempDir("", tmpDirPrefix)
|
|
||||||
if err != nil {
|
|
||||||
return nil, "", "", err
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
os.RemoveAll(tmpDir)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
dbPath := filepath.Join(tmpDir, "db.sql")
|
|
||||||
specsDir := filepath.Join(tmpDir, "specs")
|
|
||||||
lockDir := filepath.Join(tmpDir, "locks")
|
|
||||||
|
|
||||||
runtime := new(Runtime)
|
|
||||||
runtime.config = new(RuntimeConfig)
|
|
||||||
runtime.config.StorageConfig = storage.StoreOptions{}
|
|
||||||
|
|
||||||
state, err := NewSQLState(dbPath, specsDir, lockDir, runtime)
|
|
||||||
if err != nil {
|
|
||||||
return nil, "", "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
return state, tmpDir, lockDir, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func runForAllStates(t *testing.T, testFunc func(*testing.T, State, string)) {
|
func runForAllStates(t *testing.T, testFunc func(*testing.T, State, string)) {
|
||||||
for stateName, stateFunc := range testedStates {
|
for stateName, stateFunc := range testedStates {
|
||||||
state, path, lockPath, err := stateFunc()
|
state, path, lockPath, err := stateFunc()
|
||||||
|
|
Loading…
Reference in New Issue