mirror of
				https://github.com/opencontainers/runc.git
				synced 2025-10-31 11:06:21 +08:00 
			
		
		
		
	 102b8abd26
			
		
	
	102b8abd26
	
	
	
		
			
			The only implementation of these is linuxContainer. It does not make sense to have an interface with a single implementation, and we do not foresee other types of containers being added to runc. Remove BaseContainer and Container interfaces, moving their methods documentation to linuxContainer. Rename linuxContainer to Container. Adopt users from using interface to using struct. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
		
			
				
	
	
		
			60 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Package libcontainer provides a native Go implementation for creating containers
 | |
| // with namespaces, cgroups, capabilities, and filesystem access controls.
 | |
| // It allows you to manage the lifecycle of the container performing additional operations
 | |
| // after the container is created.
 | |
| package libcontainer
 | |
| 
 | |
| import (
 | |
| 	"time"
 | |
| 
 | |
| 	"github.com/opencontainers/runc/libcontainer/configs"
 | |
| )
 | |
| 
 | |
| // Status is the status of a container.
 | |
| type Status int
 | |
| 
 | |
| const (
 | |
| 	// Created is the status that denotes the container exists but has not been run yet.
 | |
| 	Created Status = iota
 | |
| 	// Running is the status that denotes the container exists and is running.
 | |
| 	Running
 | |
| 	// Paused is the status that denotes the container exists, but all its processes are paused.
 | |
| 	Paused
 | |
| 	// Stopped is the status that denotes the container does not have a created or running process.
 | |
| 	Stopped
 | |
| )
 | |
| 
 | |
| func (s Status) String() string {
 | |
| 	switch s {
 | |
| 	case Created:
 | |
| 		return "created"
 | |
| 	case Running:
 | |
| 		return "running"
 | |
| 	case Paused:
 | |
| 		return "paused"
 | |
| 	case Stopped:
 | |
| 		return "stopped"
 | |
| 	default:
 | |
| 		return "unknown"
 | |
| 	}
 | |
| }
 | |
| 
 | |
| // BaseState represents the platform agnostic pieces relating to a
 | |
| // running container's state
 | |
| type BaseState struct {
 | |
| 	// ID is the container ID.
 | |
| 	ID string `json:"id"`
 | |
| 
 | |
| 	// InitProcessPid is the init process id in the parent namespace.
 | |
| 	InitProcessPid int `json:"init_process_pid"`
 | |
| 
 | |
| 	// InitProcessStartTime is the init process start time in clock cycles since boot time.
 | |
| 	InitProcessStartTime uint64 `json:"init_process_start"`
 | |
| 
 | |
| 	// Created is the unix timestamp for the creation time of the container in UTC
 | |
| 	Created time.Time `json:"created"`
 | |
| 
 | |
| 	// Config is the container's configuration.
 | |
| 	Config configs.Config `json:"config"`
 | |
| }
 |