github.com/akerouanton/docker@v1.11.0-rc3/libcontainerd/types.go (about) 1 package libcontainerd 2 3 import "io" 4 5 // State constants used in state change reporting. 6 const ( 7 StateStart = "start-container" 8 StatePause = "pause" 9 StateResume = "resume" 10 StateExit = "exit" 11 StateRestart = "restart" 12 StateRestore = "restore" 13 StateStartProcess = "start-process" 14 StateExitProcess = "exit-process" 15 StateOOM = "oom" // fake state 16 stateLive = "live" 17 ) 18 19 // StateInfo contains description about the new state container has entered. 20 type StateInfo struct { // FIXME: event? 21 State string 22 Pid uint32 23 ExitCode uint32 24 ProcessID string 25 OOMKilled bool // TODO Windows containerd factor out 26 } 27 28 // Backend defines callbacks that the client of the library needs to implement. 29 type Backend interface { 30 StateChanged(containerID string, state StateInfo) error 31 AttachStreams(processFriendlyName string, io IOPipe) error 32 } 33 34 // Client provides access to containerd features. 35 type Client interface { 36 Create(containerID string, spec Spec, options ...CreateOption) error 37 Signal(containerID string, sig int) error 38 AddProcess(containerID, processFriendlyName string, process Process) error 39 Resize(containerID, processFriendlyName string, width, height int) error 40 Pause(containerID string) error 41 Resume(containerID string) error 42 Restore(containerID string, options ...CreateOption) error 43 Stats(containerID string) (*Stats, error) 44 GetPidsForContainer(containerID string) ([]int, error) 45 Summary(containerID string) ([]Summary, error) 46 UpdateResources(containerID string, resources Resources) error 47 } 48 49 // CreateOption allows to configure parameters of container creation. 50 type CreateOption interface { 51 Apply(interface{}) error 52 } 53 54 // IOPipe contains the stdio streams. 55 type IOPipe struct { 56 Stdin io.WriteCloser 57 Stdout io.Reader 58 Stderr io.Reader 59 Terminal bool // Whether stderr is connected on Windows 60 }