summaryrefslogtreecommitdiff
path: root/libpod/pod.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-05-14 19:30:11 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-17 23:10:12 +0000
commit018d2c6b1d23acf7fe67e809498bc354eaf6becf (patch)
tree7e4a605898905c0e0b259717d642ecbabf2516d3 /libpod/pod.go
parentc45d4c6d5ce83a89f4c536e529c2a6e7a770837e (diff)
downloadpodman-018d2c6b1d23acf7fe67e809498bc354eaf6becf.tar.gz
podman-018d2c6b1d23acf7fe67e809498bc354eaf6becf.tar.bz2
podman-018d2c6b1d23acf7fe67e809498bc354eaf6becf.zip
Add pod state
Add a mutable state to pods, and database backend sutable for modifying and updating said state. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #784 Approved by: rhatdan
Diffstat (limited to 'libpod/pod.go')
-rw-r--r--libpod/pod.go23
1 files changed, 20 insertions, 3 deletions
diff --git a/libpod/pod.go b/libpod/pod.go
index 3cad3f817..e082ef807 100644
--- a/libpod/pod.go
+++ b/libpod/pod.go
@@ -15,6 +15,7 @@ import (
// ffjson: skip
type Pod struct {
config *PodConfig
+ state *podState
valid bool
runtime *Runtime
@@ -23,9 +24,19 @@ type Pod struct {
// PodConfig represents a pod's static configuration
type PodConfig struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Labels map[string]string `json:""`
+ ID string `json:"id"`
+ Name string `json:"name"`
+
+ // Labels contains labels applied to the pod
+ Labels map[string]string `json:"labels"`
+ // CgroupParent contains the pod's CGroup parent
+ CgroupParent string `json:"cgroupParent"`
+}
+
+// podState represents a pod's state
+type podState struct {
+ // CgroupPath is the path to the pod's CGroup
+ CgroupPath string
}
// ID retrieves the pod's ID
@@ -48,12 +59,18 @@ func (p *Pod) Labels() map[string]string {
return labels
}
+// CgroupParent returns the pod's CGroup parent
+func (p *Pod) CgroupParent() string {
+ return p.config.CgroupParent
+}
+
// Creates a new, empty pod
func newPod(lockDir string, runtime *Runtime) (*Pod, error) {
pod := new(Pod)
pod.config = new(PodConfig)
pod.config.ID = stringid.GenerateNonCryptoID()
pod.config.Labels = make(map[string]string)
+ pod.state = new(podState)
pod.runtime = runtime
// Path our lock file will reside at