Documentation
¶
Index ¶
Constants ¶
const ( ExecStatusCrashed = "crashed" ExecStatusRunning = "running" ExecStatusStopped = "stopped" )
Statuses
Variables ¶
This section is empty.
Functions ¶
func ServeHTTP ¶ added in v0.0.2
func ServeHTTP(w *Worker, o ServeHTTPOptions)
ServeHTTP spawns an HTTP server
Types ¶
type ExecCmdOptions ¶ added in v0.0.2
type ExecCmdOptions struct {
Args []string
CmdAdapter func(cmd *exec.Cmd, h *ExecHandler) error
Name string
StopFunc func(cmd *exec.Cmd) error
}
ExecCmdOptions represents exec options
type ExecHandler ¶ added in v0.0.2
type ExecHandler struct {
// contains filtered or unexported fields
}
ExecHandler represents an object capable of handling the execution of a cmd
func ExecCmd ¶ added in v0.0.2
func ExecCmd(w *Worker, o ExecCmdOptions) (h *ExecHandler, err error)
ExecCmd executes a cmd The process will be stopped when the worker stops
func (*ExecHandler) Status ¶ added in v0.0.2
func (h *ExecHandler) Status() string
func (*ExecHandler) Stop ¶ added in v0.0.2
func (h *ExecHandler) Stop()
type ServeHTTPOptions ¶ added in v0.0.2
ServeHTTPOptions represents serve options
type SignalHandler ¶ added in v0.0.2
SignalHandler represents a func that can handle a signal
func TermSignalHandler ¶ added in v0.0.2
func TermSignalHandler(f func()) SignalHandler
TermSignalHandler returns a SignalHandler that is executed only on a term signal
type Task ¶ added in v0.0.2
type Task struct {
// contains filtered or unexported fields
}
Task represents a task
func (*Task) NewSubTask ¶ added in v0.0.2
NewSubTask creates a new sub task
type TaskFunc ¶ added in v0.0.2
type TaskFunc func() *Task
TaskFunc represents a function that can create a new task
type Timestamp ¶
Timestamp represents a timestamp you can marshal and umarshal
func (Timestamp) MarshalJSON ¶
MarshalJSON implements the JSONMarshaler interface
func (Timestamp) MarshalText ¶
MarshalText implements the TextMarshaler interface
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the JSONUnmarshaler interface
func (*Timestamp) UnmarshalText ¶
UnmarshalText implements the TextUnmarshaler interface
type Worker ¶ added in v0.0.2
type Worker struct {
// contains filtered or unexported fields
}
Worker represents an object capable of blocking, handling signals and stopping
func (*Worker) HandleSignals ¶ added in v0.0.2
func (w *Worker) HandleSignals(hs ...SignalHandler)
HandleSignals handles signals