Documentation
¶
Overview ¶
Package example provides an example job and job factory. The job type is "shell-command", and the factory only build this job type. By default, this factory is imported in ../external/factory.go, which allows Spin Cycle to be build without external jobs.
Index ¶
- Variables
- type Nop
- func (j *Nop) Create(jobArgs map[string]interface{}) error
- func (j *Nop) Deserialize(bytes []byte) error
- func (j *Nop) Name() string
- func (j *Nop) Run(jobData map[string]interface{}) (job.Return, error)
- func (j *Nop) Serialize() ([]byte, error)
- func (j *Nop) Status() string
- func (j *Nop) Stop() error
- func (j *Nop) Type() string
- type ShellCommand
- func (j *ShellCommand) Create(jobArgs map[string]interface{}) error
- func (j *ShellCommand) Deserialize(bytes []byte) error
- func (j *ShellCommand) Name() string
- func (j *ShellCommand) Run(jobData map[string]interface{}) (job.Return, error)
- func (j *ShellCommand) Serialize() ([]byte, error)
- func (j *ShellCommand) Status() string
- func (j *ShellCommand) Stop() error
- func (j *ShellCommand) Type() string
Constants ¶
This section is empty.
Variables ¶
var Factory job.Factory = factory{}
Factory is a job.Factory that makes "shell-command" type jobs.
Functions ¶
This section is empty.
Types ¶
type Nop ¶
type Nop struct {
// contains filtered or unexported fields
}
Nop is a no-op job that does nothing and always returns success. It's used in place of jobs that we want to include in a job chain but haven't implemented yet.
func (*Nop) Deserialize ¶
type ShellCommand ¶
type ShellCommand struct {
// Internal data (serialized)
Cmd string `json:"cmd"` // command to execute
Args []string `json:"args,omitempty"` // args to cmd
*sync.RWMutex
// contains filtered or unexported fields
}
ShellCommand is a job.Job that runs a single shell command with arguments.
func NewShellCommand ¶
func NewShellCommand(jobName string) *ShellCommand
NewShellCommand instantiates a new ShellCommand job. This should only be called by the Factory. jobName must be unique within a job chain.
func (*ShellCommand) Create ¶
func (j *ShellCommand) Create(jobArgs map[string]interface{}) error
Create is a job.Job interface method.
func (*ShellCommand) Deserialize ¶
func (j *ShellCommand) Deserialize(bytes []byte) error
Deserialize is a job.Job interface method.
func (*ShellCommand) Name ¶
func (j *ShellCommand) Name() string
Name is a job.Job interface method.
func (*ShellCommand) Run ¶
func (j *ShellCommand) Run(jobData map[string]interface{}) (job.Return, error)
Run is a job.Job interface method.
func (*ShellCommand) Serialize ¶
func (j *ShellCommand) Serialize() ([]byte, error)
Serialize is a job.Job interface method.
func (*ShellCommand) Status ¶
func (j *ShellCommand) Status() string
Status is a job.Job interface method.
func (*ShellCommand) Type ¶
func (j *ShellCommand) Type() string
Type is a job.Job interface method.