From 4f2bf5ba1c27d686c0405e008a07d642d5a1e510 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Thu, 18 Jan 2018 11:46:10 -0500 Subject: Rename ContainerState to ContainerStatus Signed-off-by: Matthew Heon --- libpod/container.go | 26 ++++++++++++-------------- libpod/container_internal.go | 6 ++++++ libpod/sql_state.go | 2 +- libpod/sql_state_internal.go | 2 +- 4 files changed, 20 insertions(+), 16 deletions(-) (limited to 'libpod') diff --git a/libpod/container.go b/libpod/container.go index 2c2377327..996f79ea4 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -15,28 +15,26 @@ import ( "github.com/ulule/deepcopier" ) -// ContainerState represents the current state of a container -type ContainerState int +// ContainerStatus represents the current state of a container +type ContainerStatus int const ( // ContainerStateUnknown indicates that the container is in an error // state where information about it cannot be retrieved - ContainerStateUnknown ContainerState = iota + ContainerStateUnknown ContainerStatus = iota // ContainerStateConfigured indicates that the container has had its // storage configured but it has not been created in the OCI runtime - ContainerStateConfigured ContainerState = iota + ContainerStateConfigured ContainerStatus = iota // ContainerStateCreated indicates the container has been created in // the OCI runtime but not started - ContainerStateCreated ContainerState = iota + ContainerStateCreated ContainerStatus = iota // ContainerStateRunning indicates the container is currently executing - ContainerStateRunning ContainerState = iota + ContainerStateRunning ContainerStatus = iota // ContainerStateStopped indicates that the container was running but has // exited - ContainerStateStopped ContainerState = iota + ContainerStateStopped ContainerStatus = iota // ContainerStatePaused indicates that the container has been paused - ContainerStatePaused ContainerState = iota - // name of the directory holding the artifacts - artifactsDir = "artifacts" + ContainerStatePaused ContainerStatus = iota ) // CgroupParent is the default prefix to a cgroup path in libpod @@ -115,7 +113,7 @@ type Container struct { // It is stored on disk in a tmpfs and recreated on reboot type containerRuntimeInfo struct { // The current state of the running container - State ContainerState `json:"state"` + State ContainerStatus `json:"state"` // The path to the JSON OCI runtime spec for this container ConfigPath string `json:"configPath,omitempty"` // RunDir is a per-boot directory for container content @@ -242,9 +240,9 @@ type ContainerConfig struct { // TODO log options - logpath for plaintext, others for log drivers } -// ContainerStater returns a string representation for users +// ContainerStatus returns a string representation for users // of a container state -func (t ContainerState) String() string { +func (t ContainerStatus) String() string { switch t { case ContainerStateUnknown: return "unknown" @@ -449,7 +447,7 @@ func (c *Container) FinishedTime() (time.Time, error) { } // State returns the current state of the container -func (c *Container) State() (ContainerState, error) { +func (c *Container) State() (ContainerStatus, error) { if !c.locked { c.lock.Lock() defer c.lock.Unlock() diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 245246869..73f9c6961 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -22,6 +22,12 @@ import ( "golang.org/x/sys/unix" ) +const ( + // name of the directory holding the artifacts + artifactsDir = "artifacts" + +) + // rootFsSize gets the size of the container's root filesystem // A container FS is split into two parts. The first is the top layer, a // mutable layer, and the rest is the RootFS: the set of immutable layers diff --git a/libpod/sql_state.go b/libpod/sql_state.go index e69db961f..4299b29ab 100644 --- a/libpod/sql_state.go +++ b/libpod/sql_state.go @@ -528,7 +528,7 @@ func (s *SQLState) UpdateContainer(ctr *Container) error { } newState := new(containerRuntimeInfo) - newState.State = ContainerState(state) + newState.State = ContainerStatus(state) newState.ConfigPath = configPath newState.RunDir = runDir newState.Mountpoint = mountpoint diff --git a/libpod/sql_state_internal.go b/libpod/sql_state_internal.go index 189fae190..1dbc466e4 100644 --- a/libpod/sql_state_internal.go +++ b/libpod/sql_state_internal.go @@ -502,7 +502,7 @@ func (s *SQLState) ctrFromScannable(row scannable) (*Container, error) { ctr.config.StopTimeout = stopTimeout ctr.config.CgroupParent = cgroupParent - ctr.state.State = ContainerState(state) + ctr.state.State = ContainerStatus(state) ctr.state.ConfigPath = configPath ctr.state.RunDir = runDir ctr.state.Mountpoint = mountpoint -- cgit v1.2.3-54-g00ecf