mirror of
https://github.com/containers/podman.git
synced 2025-07-04 01:48:28 +08:00
Address review comments, fix gofmt and lint
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
This commit is contained in:
@ -92,7 +92,7 @@ type containerConfig struct {
|
|||||||
RootfsImageName string `json:"rootfsImageName,omitempty"`
|
RootfsImageName string `json:"rootfsImageName,omitempty"`
|
||||||
UseImageConfig bool `json:"useImageConfig"`
|
UseImageConfig bool `json:"useImageConfig"`
|
||||||
// SELinux mount label for root filesystem
|
// SELinux mount label for root filesystem
|
||||||
MountLabel string `json:"MountLabel,omitempty"`
|
MountLabel string `json:"MountLabel,omitempty"`
|
||||||
// Static directory for container content that will persist across
|
// Static directory for container content that will persist across
|
||||||
// reboot
|
// reboot
|
||||||
StaticDir string `json:"staticDir"`
|
StaticDir string `json:"staticDir"`
|
||||||
|
@ -7,12 +7,14 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
// Use SQLite backend for sql package
|
||||||
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SqlState is a state implementation backed by a persistent SQLite3 database
|
// SQLState is a state implementation backed by a persistent SQLite3 database
|
||||||
type SQLState struct {
|
type SQLState struct {
|
||||||
db *sql.DB
|
db *sql.DB
|
||||||
specsDir string
|
specsDir string
|
||||||
@ -22,7 +24,7 @@ type SQLState struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSqlState initializes a SQL-backed state, created the database if necessary
|
// NewSqlState initializes a SQL-backed state, created the database if necessary
|
||||||
func NewSqlState(dbPath, lockPath, specsDir string, runtime *Runtime) (State, error) {
|
func NewSQLState(dbPath, lockPath, specsDir string, runtime *Runtime) (State, error) {
|
||||||
state := new(SQLState)
|
state := new(SQLState)
|
||||||
|
|
||||||
state.runtime = runtime
|
state.runtime = runtime
|
||||||
@ -85,8 +87,7 @@ func (s *SQLState) Close() error {
|
|||||||
|
|
||||||
s.valid = false
|
s.valid = false
|
||||||
|
|
||||||
err := s.db.Close()
|
if err := s.db.Close(); err != nil {
|
||||||
if err != nil {
|
|
||||||
return errors.Wrapf(err, "error closing database")
|
return errors.Wrapf(err, "error closing database")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,6 +428,7 @@ func (s *SQLState) RemovePod(pod *Pod) error {
|
|||||||
return ErrNotImplemented
|
return ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AllPods retrieves all pods presently in the state
|
||||||
func (s *SQLState) AllPods() ([]*Pod, error) {
|
func (s *SQLState) AllPods() ([]*Pod, error) {
|
||||||
return nil, ErrNotImplemented
|
return nil, ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,12 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
_ "github.com/mattn/go-sqlite3"
|
|
||||||
spec "github.com/opencontainers/runtime-spec/specs-go"
|
spec "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
// Use SQLite backend for sql package
|
||||||
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Performs database setup including by not limited to initializing tables in
|
// Performs database setup including by not limited to initializing tables in
|
||||||
|
Reference in New Issue
Block a user