github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/runsc/container/status.go (about) 1 // Copyright 2018 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package container 16 17 // Status enumerates container statuses. The statuses and their semantics are 18 // part of the runtime CLI spec. 19 type Status int 20 21 const ( 22 // Created indicates "the runtime has finished the create operation and 23 // the container process has neither exited nor executed the 24 // user-specified program". 25 Created Status = iota 26 27 // Creating indicates "the container is being created". 28 Creating 29 30 // Paused indicates that the process within the container has been 31 // suspended. 32 Paused 33 34 // Running indicates "the container process has executed the 35 // user-specified program but has not exited". 36 Running 37 38 // Stopped indicates "the container process has exited". 39 Stopped 40 ) 41 42 // String converts a Status to a string. These strings are part of the runtime 43 // CLI spec and should not be changed. 44 func (s Status) String() string { 45 switch s { 46 case Created: 47 return "created" 48 case Creating: 49 return "creating" 50 case Paused: 51 return "paused" 52 case Running: 53 return "running" 54 case Stopped: 55 return "stopped" 56 default: 57 return "unknown" 58 } 59 60 }