Add support for multiple executor backends. Create Executor interface and allow executors to register themselves with the application. Update README (Todo list).

This commit is contained in:
James Munnelly
2015-09-08 10:09:28 +01:00
parent 1c80f8d4a0
commit 06b3caa923
5 changed files with 264 additions and 105 deletions
+47
View File
@@ -0,0 +1,47 @@
package executors
import (
"fmt"
)
type Job struct {
Command []string
Args []string
}
type Executor interface {
Start() error
Stop() error
WaitForState(ExecutorPhase) error
String() string
}
type AbstractExecutor struct {
Job Job
}
type ExecutorPhase string
const (
ExecutorPreparing ExecutorPhase = "Preparing"
ExecutorRunning ExecutorPhase = "Running"
ExecutorSucceeded ExecutorPhase = "Succeeded"
ExecutorFailed ExecutorPhase = "Failed"
ExecutorUnknown ExecutorPhase = "Unknown"
)
func (e *AbstractExecutor) Start() error {
return nil
}
func (e *AbstractExecutor) Stop() error {
return nil
}
func (e *AbstractExecutor) WaitForState(p ExecutorPhase) error {
return nil
}
func (e *AbstractExecutor) String() string {
return fmt.Sprintf("%s %s", e.Job.Command, e.Job.Args)
}