Supervisor compiles
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
cc00a35bfc
commit
cdb5947f86
9 changed files with 129 additions and 40 deletions
|
@ -1,3 +1,5 @@
|
|||
// +build !windows
|
||||
|
||||
package supervisor
|
||||
|
||||
import "github.com/docker/containerd/runtime"
|
||||
|
|
|
@ -8,13 +8,13 @@ import (
|
|||
|
||||
type StartTask struct {
|
||||
baseTask
|
||||
platformStartTask
|
||||
ID string
|
||||
BundlePath string
|
||||
Stdout string
|
||||
Stderr string
|
||||
Stdin string
|
||||
StartResponse chan StartResponse
|
||||
Checkpoint *runtime.Checkpoint
|
||||
Labels []string
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,8 @@ func (s *Supervisor) start(t *StartTask) error {
|
|||
Stdout: t.Stdout,
|
||||
Stderr: t.Stderr,
|
||||
}
|
||||
if t.Checkpoint != nil {
|
||||
task.Checkpoint = t.Checkpoint.Name
|
||||
}
|
||||
task.setTaskCheckpoint(t)
|
||||
|
||||
s.startTasks <- task
|
||||
ContainerCreateTimer.UpdateSince(start)
|
||||
return errDeferedResponse
|
||||
|
|
13
supervisor/create_linux.go
Normal file
13
supervisor/create_linux.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package supervisor
|
||||
|
||||
import "github.com/docker/containerd/runtime"
|
||||
|
||||
type platformStartTask struct {
|
||||
Checkpoint *runtime.Checkpoint
|
||||
}
|
||||
|
||||
func (task *startTask) setTaskCheckpoint(t *StartTask) {
|
||||
if t.Checkpoint != nil {
|
||||
task.Checkpoint = t.Checkpoint.Name
|
||||
}
|
||||
}
|
8
supervisor/create_windows.go
Normal file
8
supervisor/create_windows.go
Normal file
|
@ -0,0 +1,8 @@
|
|||
package supervisor
|
||||
|
||||
type platformStartTask struct {
|
||||
}
|
||||
|
||||
// Checkpoint not supported on Windows
|
||||
func (task *startTask) setTaskCheckpoint(t *StartTask) {
|
||||
}
|
33
supervisor/monitor_windows.go
Normal file
33
supervisor/monitor_windows.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package supervisor
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/docker/containerd/runtime"
|
||||
)
|
||||
|
||||
// TODO Windows: This is going to be very problematic to port to Windows.
|
||||
// Windows golang has no concept of EpollEvent/EpollCtl etc as in the
|
||||
// Linux implementation. @crosbymichael - Help needed.
|
||||
|
||||
func NewMonitor() (*Monitor, error) {
|
||||
return nil, errors.New("NewMonitor not implemented on Windows")
|
||||
}
|
||||
|
||||
type Monitor struct {
|
||||
}
|
||||
|
||||
func (m *Monitor) Exits() chan runtime.Process {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Monitor) Monitor(p runtime.Process) error {
|
||||
return errors.New("Monitor not implemented on Windows")
|
||||
}
|
||||
|
||||
func (m *Monitor) Close() error {
|
||||
return errors.New("Monitor Close() not implemented on Windows")
|
||||
}
|
||||
|
||||
func (m *Monitor) start() {
|
||||
}
|
|
@ -216,42 +216,6 @@ func (s *Supervisor) Start() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *Supervisor) handleTask(i Task) {
|
||||
var err error
|
||||
switch t := i.(type) {
|
||||
case *AddProcessTask:
|
||||
err = s.addProcess(t)
|
||||
case *CreateCheckpointTask:
|
||||
err = s.createCheckpoint(t)
|
||||
case *DeleteCheckpointTask:
|
||||
err = s.deleteCheckpoint(t)
|
||||
case *StartTask:
|
||||
err = s.start(t)
|
||||
case *DeleteTask:
|
||||
err = s.delete(t)
|
||||
case *ExitTask:
|
||||
err = s.exit(t)
|
||||
case *ExecExitTask:
|
||||
err = s.execExit(t)
|
||||
case *GetContainersTask:
|
||||
err = s.getContainers(t)
|
||||
case *SignalTask:
|
||||
err = s.signal(t)
|
||||
case *StatsTask:
|
||||
err = s.stats(t)
|
||||
case *UpdateTask:
|
||||
err = s.updateContainer(t)
|
||||
case *UpdateProcessTask:
|
||||
err = s.updateProcess(t)
|
||||
default:
|
||||
err = ErrUnknownTask
|
||||
}
|
||||
if err != errDeferedResponse {
|
||||
i.ErrorCh() <- err
|
||||
close(i.ErrorCh())
|
||||
}
|
||||
}
|
||||
|
||||
// Machine returns the machine information for which the
|
||||
// supervisor is executing on.
|
||||
func (s *Supervisor) Machine() Machine {
|
||||
|
|
37
supervisor/supervisor_linux.go
Normal file
37
supervisor/supervisor_linux.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package supervisor
|
||||
|
||||
func (s *Supervisor) handleTask(i Task) {
|
||||
var err error
|
||||
switch t := i.(type) {
|
||||
case *AddProcessTask:
|
||||
err = s.addProcess(t)
|
||||
case *CreateCheckpointTask:
|
||||
err = s.createCheckpoint(t)
|
||||
case *DeleteCheckpointTask:
|
||||
err = s.deleteCheckpoint(t)
|
||||
case *StartTask:
|
||||
err = s.start(t)
|
||||
case *DeleteTask:
|
||||
err = s.delete(t)
|
||||
case *ExitTask:
|
||||
err = s.exit(t)
|
||||
case *ExecExitTask:
|
||||
err = s.execExit(t)
|
||||
case *GetContainersTask:
|
||||
err = s.getContainers(t)
|
||||
case *SignalTask:
|
||||
err = s.signal(t)
|
||||
case *StatsTask:
|
||||
err = s.stats(t)
|
||||
case *UpdateTask:
|
||||
err = s.updateContainer(t)
|
||||
case *UpdateProcessTask:
|
||||
err = s.updateProcess(t)
|
||||
default:
|
||||
err = ErrUnknownTask
|
||||
}
|
||||
if err != errDeferedResponse {
|
||||
i.ErrorCh() <- err
|
||||
close(i.ErrorCh())
|
||||
}
|
||||
}
|
33
supervisor/supervisor_windows.go
Normal file
33
supervisor/supervisor_windows.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package supervisor
|
||||
|
||||
func (s *Supervisor) handleTask(i Task) {
|
||||
var err error
|
||||
switch t := i.(type) {
|
||||
case *AddProcessTask:
|
||||
err = s.addProcess(t)
|
||||
case *StartTask:
|
||||
err = s.start(t)
|
||||
case *DeleteTask:
|
||||
err = s.delete(t)
|
||||
case *ExitTask:
|
||||
err = s.exit(t)
|
||||
case *ExecExitTask:
|
||||
err = s.execExit(t)
|
||||
case *GetContainersTask:
|
||||
err = s.getContainers(t)
|
||||
case *SignalTask:
|
||||
err = s.signal(t)
|
||||
case *StatsTask:
|
||||
err = s.stats(t)
|
||||
case *UpdateTask:
|
||||
err = s.updateContainer(t)
|
||||
case *UpdateProcessTask:
|
||||
err = s.updateProcess(t)
|
||||
default:
|
||||
err = ErrUnknownTask
|
||||
}
|
||||
if err != errDeferedResponse {
|
||||
i.ErrorCh() <- err
|
||||
close(i.ErrorCh())
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue