aboutsummaryrefslogtreecommitdiff
path: root/libpod/define
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-02-03 15:20:19 -0500
committerMatthew Heon <matthew.heon@pm.me>2020-03-18 11:02:14 -0400
commitf138405b46cdeb1cd8848ffc169a355433def9e2 (patch)
treea30f58910f618d470e18a3c38384484b47c0d1f8 /libpod/define
parentd9eb078e2a1cff73461f285924ab1ab8699e9bca (diff)
downloadpodman-f138405b46cdeb1cd8848ffc169a355433def9e2.tar.gz
podman-f138405b46cdeb1cd8848ffc169a355433def9e2.tar.bz2
podman-f138405b46cdeb1cd8848ffc169a355433def9e2.zip
Populate ExecSession with all required fields
As part of the rework of exec sessions, we want to split Create and Start - and, as a result, we need to keep everything needed to start exec sessions in the struct, not just the bare minimum for tracking running ones. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/define')
-rw-r--r--libpod/define/containerstate.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/libpod/define/containerstate.go b/libpod/define/containerstate.go
index e7d258e21..6da49a594 100644
--- a/libpod/define/containerstate.go
+++ b/libpod/define/containerstate.go
@@ -78,3 +78,37 @@ func StringToContainerStatus(status string) (ContainerStatus, error) {
return ContainerStateUnknown, errors.Wrapf(ErrInvalidArg, "unknown container state: %s", status)
}
}
+
+// ContainerExecStatus is the status of an exec session within a container.
+type ContainerExecStatus int
+
+const (
+ // ExecStateUnknown indicates that the state of the exec session is not
+ // known.
+ ExecStateUnknown ContainerExecStatus = iota
+ // ExecStateCreated indicates that the exec session has been created but
+ // not yet started
+ ExecStateCreated ContainerExecStatus = iota
+ // ExecStateRunning indicates that the exec session has been started but
+ // has not yet exited.
+ ExecStateRunning ContainerExecStatus = iota
+ // ExecStateStopped indicates that the exec session has stopped and is
+ // no longer running.
+ ExecStateStopped ContainerExecStatus = iota
+)
+
+// String returns a string representation of a given exec state.
+func (s ContainerExecStatus) String() string {
+ switch s {
+ case ExecStateUnknown:
+ return "unknown"
+ case ExecStateCreated:
+ return "created"
+ case ExecStateRunning:
+ return "running"
+ case ExecStateStopped:
+ return "stopped"
+ default:
+ return "bad state"
+ }
+}