Start work on Container and Process model
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
6641888667
commit
32bf0f69fd
38 changed files with 525 additions and 353 deletions
41
execution/process.go
Normal file
41
execution/process.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
package execution
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
type ProcessController interface {
|
||||
Start(*Process) error
|
||||
Status(*Process) (Status, error)
|
||||
Wait(*Process) (uint32, error)
|
||||
Signal(*Process, os.Signal) error
|
||||
}
|
||||
|
||||
type Process struct {
|
||||
Pid int
|
||||
Spec *specs.Process
|
||||
Stdin io.Reader
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
|
||||
controller ProcessController
|
||||
}
|
||||
|
||||
func (p *Process) Status() (Status, error) {
|
||||
return p.controller.Status(p)
|
||||
}
|
||||
|
||||
func (p *Process) Wait() (uint32, error) {
|
||||
return p.controller.Wait(p)
|
||||
}
|
||||
|
||||
func (p *Process) Signal(s os.Signal) error {
|
||||
return p.controller.Signal(p, s)
|
||||
}
|
||||
|
||||
func (p *Process) Start() error {
|
||||
return p.controller.Start(p)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue