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:
Matthew Heon
2018-03-26 11:40:57 -04:00
committed by Atomic Bot
parent f2894f243b
commit b18f089545
4 changed files with 2 additions and 2275 deletions

View File

@ -30,6 +30,7 @@ const (
// reboot
InMemoryStateStore RuntimeStateStore = iota
// SQLiteStateStore is a state backed by a SQLite database
// It is presently disabled
SQLiteStateStore RuntimeStateStore = iota
// BoltDBStateStore is a state backed by a BoltDB database
BoltDBStateStore RuntimeStateStore = iota
@ -386,23 +387,7 @@ func makeRuntime(runtime *Runtime) error {
}
runtime.state = state
case SQLiteStateStore:
dbPath := filepath.Join(runtime.config.StaticDir, "sql_state.db")
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
return errors.Wrapf(ErrInvalidArg, "SQLite state is currently disabled")
case BoltDBStateStore:
dbPath := filepath.Join(runtime.config.StaticDir, "bolt_state.db")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,6 @@ const (
var (
testedStates = map[string]emptyStateFunc{
"sql": getEmptySQLState,
"in-memory": getEmptyInMemoryState,
"boltdb": getEmptyBoltState,
}
@ -79,35 +78,6 @@ func getEmptyInMemoryState() (s State, p string, p2 string, err error) {
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)) {
for stateName, stateFunc := range testedStates {
state, path, lockPath, err := stateFunc()