2019-04-29 21:25:05 +00:00
|
|
|
// Copyright 2018 The gVisor Authors.
|
2018-04-27 17:37:02 +00:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2018-05-15 17:17:19 +00:00
|
|
|
package container
|
2018-04-27 17:37:02 +00:00
|
|
|
|
2018-05-15 17:17:19 +00:00
|
|
|
// Status enumerates container statuses. The statuses and their semantics are
|
2018-04-27 17:37:02 +00:00
|
|
|
// part of the runtime CLI spec.
|
|
|
|
type Status int
|
|
|
|
|
|
|
|
const (
|
|
|
|
// Created indicates "the runtime has finished the create operation and
|
|
|
|
// the container process has neither exited nor executed the
|
|
|
|
// user-specified program".
|
2018-06-15 23:08:20 +00:00
|
|
|
Created Status = iota
|
|
|
|
|
|
|
|
// Creating indicates "the container is being created".
|
|
|
|
Creating
|
|
|
|
|
|
|
|
// Paused indicates that the process within the container has been
|
|
|
|
// suspended.
|
|
|
|
Paused
|
2018-04-27 17:37:02 +00:00
|
|
|
|
|
|
|
// Running indicates "the container process has executed the
|
|
|
|
// user-specified program but has not exited".
|
|
|
|
Running
|
|
|
|
|
|
|
|
// Stopped indicates "the container process has exited".
|
|
|
|
Stopped
|
|
|
|
)
|
|
|
|
|
2018-05-15 17:17:19 +00:00
|
|
|
// String converts a Status to a string. These strings are part of the runtime
|
2018-04-27 17:37:02 +00:00
|
|
|
// CLI spec and should not be changed.
|
|
|
|
func (s Status) String() string {
|
|
|
|
switch s {
|
|
|
|
case Created:
|
|
|
|
return "created"
|
2018-06-15 23:08:20 +00:00
|
|
|
case Creating:
|
|
|
|
return "creating"
|
|
|
|
case Paused:
|
|
|
|
return "paused"
|
2018-04-27 17:37:02 +00:00
|
|
|
case Running:
|
|
|
|
return "running"
|
|
|
|
case Stopped:
|
|
|
|
return "stopped"
|
|
|
|
default:
|
|
|
|
return "unknown"
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|