Documentation
¶
Index ¶
- Constants
- Variables
- func InitTaskRuntimes(cfg *TaskRuntimeConfig)
- func RegisterSupportedTaskType(taskType TaskType)
- func StopTaskRuntimes()
- func UnregisterSupportedTaskType(taskType TaskType)
- type DockerTask
- func (p *DockerTask) CommChannels() (chan Message, chan Message, error)
- func (p *DockerTask) GetResult() *error
- func (p *DockerTask) GetVar(key TaskVar) (interface{}, bool)
- func (p *DockerTask) ID() TaskID
- func (p *DockerTask) Name() string
- func (p *DockerTask) NextRequestID() uint64
- func (p *DockerTask) SetVar(key TaskVar, value interface{})
- func (p *DockerTask) Start() error
- func (p *DockerTask) Status() TaskStatus
- func (p *DockerTask) Stop() error
- func (p *DockerTask) Wait() (int, error)
- type DockerTaskRuntime
- type DylibTaskRuntime
- type Message
- type ProcessTask
- func (p *ProcessTask) CommChannels() (chan Message, chan Message, error)
- func (p *ProcessTask) GetResult() *error
- func (p *ProcessTask) GetVar(key TaskVar) (interface{}, bool)
- func (p *ProcessTask) ID() TaskID
- func (p *ProcessTask) Name() string
- func (p *ProcessTask) NextRequestID() uint64
- func (p *ProcessTask) SetVar(key TaskVar, value interface{})
- func (p *ProcessTask) Start() error
- func (p *ProcessTask) Status() TaskStatus
- func (p *ProcessTask) Stop() error
- func (p *ProcessTask) Wait() (int, error)
- type ProcessTaskRuntime
- type Task
- type TaskConfig
- type TaskID
- type TaskRuntime
- type TaskRuntimeConfig
- type TaskStatus
- type TaskType
- type TaskVar
- type WasmTaskRuntime
Constants ¶
View Source
const (
DockerRuntimeTcpListenPortBase = 8100
)
View Source
const (
SPEARDockerReadBufferSize = 4 * 1024 * 1024
)
Variables ¶
View Source
var (
DockerRuntimeTcpListenPort = ""
)
Functions ¶
func RegisterSupportedTaskType ¶
func RegisterSupportedTaskType(taskType TaskType)
register task runtime
func StopTaskRuntimes ¶
func StopTaskRuntimes()
func UnregisterSupportedTaskType ¶
func UnregisterSupportedTaskType(taskType TaskType)
unregister task runtime
Types ¶
type DockerTask ¶
type DockerTask struct {
// contains filtered or unexported fields
}
func (*DockerTask) CommChannels ¶
func (p *DockerTask) CommChannels() (chan Message, chan Message, error)
func (*DockerTask) GetResult ¶
func (p *DockerTask) GetResult() *error
func (*DockerTask) GetVar ¶
func (p *DockerTask) GetVar(key TaskVar) (interface{}, bool)
func (*DockerTask) ID ¶
func (p *DockerTask) ID() TaskID
func (*DockerTask) Name ¶
func (p *DockerTask) Name() string
func (*DockerTask) NextRequestID ¶
func (p *DockerTask) NextRequestID() uint64
func (*DockerTask) SetVar ¶
func (p *DockerTask) SetVar(key TaskVar, value interface{})
func (*DockerTask) Start ¶
func (p *DockerTask) Start() error
func (*DockerTask) Status ¶
func (p *DockerTask) Status() TaskStatus
func (*DockerTask) Stop ¶
func (p *DockerTask) Stop() error
func (*DockerTask) Wait ¶
func (p *DockerTask) Wait() (int, error)
type DockerTaskRuntime ¶
type DockerTaskRuntime struct {
// contains filtered or unexported fields
}
func NewDockerTaskRuntime ¶
func NewDockerTaskRuntime(rtCfg *TaskRuntimeConfig) (*DockerTaskRuntime, error)
func (*DockerTaskRuntime) CreateTask ¶
func (d *DockerTaskRuntime) CreateTask(cfg *TaskConfig) (Task, error)
func (*DockerTaskRuntime) Start ¶
func (d *DockerTaskRuntime) Start() error
func (*DockerTaskRuntime) Stop ¶
func (d *DockerTaskRuntime) Stop() error
type DylibTaskRuntime ¶
type DylibTaskRuntime struct { }
implement TaskRuntimeDylib
func (*DylibTaskRuntime) CreateTask ¶
func (d *DylibTaskRuntime) CreateTask(cfg *TaskConfig) (Task, error)
func (*DylibTaskRuntime) Start ¶
func (d *DylibTaskRuntime) Start() error
func (*DylibTaskRuntime) Stop ¶
func (d *DylibTaskRuntime) Stop() error
type ProcessTask ¶
type ProcessTask struct {
// contains filtered or unexported fields
}
func NewProcessTask ¶
func NewProcessTask(cfg *TaskConfig) *ProcessTask
func (*ProcessTask) CommChannels ¶
func (p *ProcessTask) CommChannels() (chan Message, chan Message, error)
func (*ProcessTask) GetResult ¶
func (p *ProcessTask) GetResult() *error
func (*ProcessTask) GetVar ¶
func (p *ProcessTask) GetVar(key TaskVar) (interface{}, bool)
func (*ProcessTask) ID ¶
func (p *ProcessTask) ID() TaskID
func (*ProcessTask) Name ¶
func (p *ProcessTask) Name() string
func (*ProcessTask) NextRequestID ¶
func (p *ProcessTask) NextRequestID() uint64
func (*ProcessTask) SetVar ¶
func (p *ProcessTask) SetVar(key TaskVar, value interface{})
func (*ProcessTask) Start ¶
func (p *ProcessTask) Start() error
func (*ProcessTask) Status ¶
func (p *ProcessTask) Status() TaskStatus
func (*ProcessTask) Stop ¶
func (p *ProcessTask) Stop() error
func (*ProcessTask) Wait ¶
func (p *ProcessTask) Wait() (int, error)
type ProcessTaskRuntime ¶
type ProcessTaskRuntime struct { }
implement TaskRuntimeProcess
func NewProcessTaskRuntime ¶
func NewProcessTaskRuntime() *ProcessTaskRuntime
func (*ProcessTaskRuntime) CreateTask ¶
func (p *ProcessTaskRuntime) CreateTask(cfg *TaskConfig) (Task, error)
func (*ProcessTaskRuntime) Start ¶
func (p *ProcessTaskRuntime) Start() error
func (*ProcessTaskRuntime) Stop ¶
func (p *ProcessTaskRuntime) Stop() error
type Task ¶
type Task interface { ID() TaskID // start task Start() error // stop task Stop() error // get task name Name() string // get task status Status() TaskStatus // get task result GetResult() *error // get communication channel CommChannels() (chan Message, chan Message, error) // wait for task to finish Wait() (int, error) // next request id NextRequestID() uint64 // set task variable SetVar(key TaskVar, value interface{}) // get task variable GetVar(key TaskVar) (interface{}, bool) }
type TaskConfig ¶
type TaskRuntime ¶
type TaskRuntime interface { // create task CreateTask(cfg *TaskConfig) (Task, error) Start() error Stop() error }
interface for taskruntime
func GetTaskRuntime ¶
func GetTaskRuntime(taskType TaskType) (TaskRuntime, error)
factory method for TaskRuntime
type TaskRuntimeConfig ¶
type TaskStatus ¶
type TaskStatus int
task status enum
const ( TaskStatusRunning TaskStatus = iota TaskStatusInit TaskStatusStopped )
type WasmTaskRuntime ¶
type WasmTaskRuntime struct { }
implement TaskRuntimeWasm
func (*WasmTaskRuntime) CreateTask ¶
func (w *WasmTaskRuntime) CreateTask(cfg *TaskConfig) (Task, error)
func (*WasmTaskRuntime) Start ¶
func (w *WasmTaskRuntime) Start() error
func (*WasmTaskRuntime) Stop ¶
func (w *WasmTaskRuntime) Stop() error
Click to show internal directories.
Click to hide internal directories.