summaryrefslogtreecommitdiff
path: root/libpod/boltdb_state.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/boltdb_state.go')
-rw-r--r--libpod/boltdb_state.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go
index ba8f7375a..5bc15dd7f 100644
--- a/libpod/boltdb_state.go
+++ b/libpod/boltdb_state.go
@@ -2,15 +2,17 @@ package libpod
import (
"bytes"
- "encoding/json"
"strings"
"sync"
"github.com/boltdb/bolt"
+ jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
+var json = jsoniter.ConfigCompatibleWithStandardLibrary
+
// BoltState is a state implementation backed by a Bolt DB
type BoltState struct {
valid bool
@@ -203,7 +205,7 @@ func (s *BoltState) Refresh() error {
return errors.Wrapf(ErrInternal, "container %s missing state in DB", string(id))
}
- state := new(containerState)
+ state := new(ContainerState)
if err := json.Unmarshal(stateBytes, state); err != nil {
return errors.Wrapf(err, "error unmarshalling state for container %s", string(id))
@@ -322,8 +324,8 @@ func (s *BoltState) Container(id string) (*Container, error) {
ctrID := []byte(id)
ctr := new(Container)
- ctr.config = new(Config)
- ctr.state = new(containerState)
+ ctr.config = new(ContainerConfig)
+ ctr.state = new(ContainerState)
db, err := s.getDBCon()
if err != nil {
@@ -358,8 +360,8 @@ func (s *BoltState) LookupContainer(idOrName string) (*Container, error) {
}
ctr := new(Container)
- ctr.config = new(Config)
- ctr.state = new(containerState)
+ ctr.config = new(ContainerConfig)
+ ctr.state = new(ContainerState)
db, err := s.getDBCon()
if err != nil {
@@ -540,7 +542,7 @@ func (s *BoltState) UpdateContainer(ctr *Container) error {
return errors.Wrapf(ErrNSMismatch, "container %s is in namespace %q, does not match our namespace %q", ctr.ID(), ctr.config.Namespace, s.namespace)
}
- newState := new(containerState)
+ newState := new(ContainerState)
netNSPath := ""
ctrID := []byte(ctr.ID())
@@ -751,8 +753,8 @@ func (s *BoltState) AllContainers() ([]*Container, error) {
}
ctr := new(Container)
- ctr.config = new(Config)
- ctr.state = new(containerState)
+ ctr.config = new(ContainerConfig)
+ ctr.state = new(ContainerState)
if err := s.getContainerFromDB(id, ctr, ctrBucket); err != nil {
// If the error is a namespace mismatch, we can
@@ -1137,8 +1139,8 @@ func (s *BoltState) PodContainers(pod *Pod) ([]*Container, error) {
// Iterate through all containers in the pod
err = podCtrs.ForEach(func(id, val []byte) error {
newCtr := new(Container)
- newCtr.config = new(Config)
- newCtr.state = new(containerState)
+ newCtr.config = new(ContainerConfig)
+ newCtr.state = new(ContainerState)
ctrs = append(ctrs, newCtr)
return s.getContainerFromDB(id, newCtr, ctrBkt)