summaryrefslogtreecommitdiff
path: root/libpod/sql_state_internal.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-02-09 17:13:07 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-02-12 14:28:07 +0000
commit4f225b47c9be6f9d72997cea83c029275c3530db (patch)
tree5b9092449ca27777657e7baf1a880bb1c313ed5b /libpod/sql_state_internal.go
parentaa85ae212e4cc23df7a6bafe8992dc76770bac87 (diff)
downloadpodman-4f225b47c9be6f9d72997cea83c029275c3530db.tar.gz
podman-4f225b47c9be6f9d72997cea83c029275c3530db.tar.bz2
podman-4f225b47c9be6f9d72997cea83c029275c3530db.zip
Refactor Pod to use a Config struct
This allows us to JSON it and stuff it in the DB - previously, all pod fields were private, so JSON couldn't encode them. This allows us to keep all pod fields private by having a substruct with public fields. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #184 Approved by: baude
Diffstat (limited to 'libpod/sql_state_internal.go')
-rw-r--r--libpod/sql_state_internal.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/libpod/sql_state_internal.go b/libpod/sql_state_internal.go
index 5e18b7cfd..3fb1ac64f 100644
--- a/libpod/sql_state_internal.go
+++ b/libpod/sql_state_internal.go
@@ -709,8 +709,9 @@ func (s *SQLState) podFromScannable(row scannable) (*Pod, error) {
}
pod := new(Pod)
- pod.id = id
- pod.name = name
+ pod.config = new(PodConfig)
+ pod.config.ID = id
+ pod.config.Name = name
pod.runtime = s.runtime
// Decode labels JSON
@@ -718,7 +719,7 @@ func (s *SQLState) podFromScannable(row scannable) (*Pod, error) {
if err := json.Unmarshal([]byte(labelsJSON), &podLabels); err != nil {
return nil, errors.Wrapf(err, "error unmarshaling pod %s labels JSON", id)
}
- pod.labels = podLabels
+ pod.config.Labels = podLabels
// Retrieve pod lock
// Open and set the lockfile