summaryrefslogtreecommitdiff
path: root/libpod/state.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2017-11-01 11:24:59 -0400
committerMatthew Heon <matthew.heon@gmail.com>2017-11-01 11:24:59 -0400
commita031b83a09a8628435317a03f199cdc18b78262f (patch)
treebc017a96769ce6de33745b8b0b1304ccf38e9df0 /libpod/state.go
parent2b74391cd5281f6fdf391ff8ad50fd1490f6bf89 (diff)
downloadpodman-a031b83a09a8628435317a03f199cdc18b78262f.tar.gz
podman-a031b83a09a8628435317a03f199cdc18b78262f.tar.bz2
podman-a031b83a09a8628435317a03f199cdc18b78262f.zip
Initial checkin from CRI-O repo
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod/state.go')
-rw-r--r--libpod/state.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/libpod/state.go b/libpod/state.go
new file mode 100644
index 000000000..1c21911bb
--- /dev/null
+++ b/libpod/state.go
@@ -0,0 +1,38 @@
+package libpod
+
+// State is a storage backend for libpod's current state
+type State interface {
+ // Accepts full ID of container
+ Container(id string) (*Container, error)
+ // Accepts full or partial IDs (as long as they are unique) and names
+ LookupContainer(idOrName string) (*Container, error)
+ // 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
+ AddContainer(ctr *Container) error
+ // Removes container from state
+ // The container will only be removed from the state, not from the pod
+ // which the container belongs to
+ RemoveContainer(ctr *Container) error
+ // Retrieves all containers presently in state
+ AllContainers() ([]*Container, error)
+
+ // Accepts full ID of pod
+ Pod(id string) (*Pod, error)
+ // Accepts full or partial IDs (as long as they are unique) and names
+ LookupPod(idOrName string) (*Pod, error)
+ // Checks if a pod with the given ID is present in the state
+ HasPod(id string) (bool, error)
+ // Adds pod to state
+ // Only empty pods can be added to the state
+ AddPod(pod *Pod) error
+ // Removes pod from state
+ // 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
+ // Retrieves all pods presently in state
+ AllPods() ([]*Pod, error)
+}