aboutsummaryrefslogtreecommitdiff
path: root/libpod/state.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2017-12-13 23:12:32 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-17 15:26:43 +0000
commit65d643caeb31364b59612f0f91be90894c65d703 (patch)
tree5899bac7ed634faa4f238332b9de896e4606aa74 /libpod/state.go
parent13f004aec5c70ca5be9f6c134566abd1e62ea660 (diff)
downloadpodman-65d643caeb31364b59612f0f91be90894c65d703.tar.gz
podman-65d643caeb31364b59612f0f91be90894c65d703.tar.bz2
podman-65d643caeb31364b59612f0f91be90894c65d703.zip
Change handling for pods in libpod state
Add new functions to update pods and add/remove containers from them Use these new functions in place of manually modifying pods Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #229 Approved by: rhatdan
Diffstat (limited to 'libpod/state.go')
-rw-r--r--libpod/state.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/libpod/state.go b/libpod/state.go
index 95012e586..01ae58bd1 100644
--- a/libpod/state.go
+++ b/libpod/state.go
@@ -16,9 +16,7 @@ type State interface {
// Checks if a container with the given ID is present in the state
HasContainer(id string) (bool, error)
// Adds container to state
- // If the container belongs to a pod, that pod must already be present
- // in the state when the container is added, and the container must be
- // present in the pod
+ // The container cannot be part of a pod
AddContainer(ctr *Container) error
// Removes container from state
// The container will only be removed from the state, not from the pod
@@ -53,6 +51,14 @@ type State interface {
// Containers within a pod will not be removed from the state, and will
// not be changed to remove them from the now-removed pod
RemovePod(pod *Pod) error
+ // UpdatePod updates a pod's state from the backing store
+ UpdatePod(pod *Pod) error
+ // AddContainerToPod adds a container to an existing pod
+ // The container given will be added to the state and the pod
+ AddContainerToPod(pod *Pod, ctr *Container) error
+ // RemoveContainerFromPod removes a container from an existing pod
+ // The container will also be removed from the state
+ RemoveContainerFromPod(pod *Pod, ctr *Container) error
// Retrieves all pods presently in state
AllPods() ([]*Pod, error)
}