summaryrefslogtreecommitdiff
path: root/libpod/boltdb_state_internal.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-02-08 13:55:02 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-02-12 14:28:07 +0000
commit363a82e6682f6b7afc6f9159c778e18009cd7c74 (patch)
treef9b7ec2c336c123b3a5bbc213d79ce06d6b99fcb /libpod/boltdb_state_internal.go
parentb4cdc27b31a638322fb83b64aea869ce8600ea01 (diff)
downloadpodman-363a82e6682f6b7afc6f9159c778e18009cd7c74.tar.gz
podman-363a82e6682f6b7afc6f9159c778e18009cd7c74.tar.bz2
podman-363a82e6682f6b7afc6f9159c778e18009cd7c74.zip
Add pod buckets
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #184 Approved by: baude
Diffstat (limited to 'libpod/boltdb_state_internal.go')
-rw-r--r--libpod/boltdb_state_internal.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go
index 8b4e8e28c..c8aa4adbf 100644
--- a/libpod/boltdb_state_internal.go
+++ b/libpod/boltdb_state_internal.go
@@ -17,6 +17,8 @@ const (
netNSName = "net-ns"
runtimeConfigName = "runtime-config"
ctrDependsName = "container-depends"
+ podName = "pod"
+ podContainersName = "pod-containers"
)
var (
@@ -27,6 +29,8 @@ var (
netNSBkt = []byte(netNSName)
runtimeConfigBkt = []byte(runtimeConfigName)
ctrDependsBkt = []byte(ctrDependsName)
+ podBkt = []byte(podName)
+ podContainersBkt = []byte(podContainersName)
)
// Check if the configuration of the database is compatible with the
@@ -158,6 +162,22 @@ func getCtrDependsBucket(tx *bolt.Tx) (*bolt.Bucket, error) {
return bkt, nil
}
+func getPodBucket(tx *bolt.Tx) (*bolt.Bucket, error) {
+ bkt := tx.Bucket(podBkt)
+ if bkt == nil {
+ return nil, errors.Wrapf(ErrDBBadConfig, "pods bucket not found in DB")
+ }
+ return bkt, nil
+}
+
+func getPodContainersBucket(tx *bolt.Tx) (*bolt.Bucket, error) {
+ bkt := tx.Bucket(podContainersBkt)
+ if bkt == nil {
+ return nil, errors.Wrapf(ErrDBBadConfig, "pod containers bucket not found in DB")
+ }
+ return bkt, nil
+}
+
func (s *BoltState) getContainerFromDB(id []byte, ctr *Container, config, state, netNS *bolt.Bucket) error {
configBytes := config.Get(id)
if configBytes == nil {