Documentation ¶
Index ¶
- func DeleteClock(name string) error
- func NewPlugin(logger hclog.Logger) drivers.DriverPlugin
- type Clock
- type Config
- type Locker
- type MIDIDriverPlugin
- func (d *MIDIDriverPlugin) Capabilities() (*drivers.Capabilities, error)
- func (d *MIDIDriverPlugin) ConfigSchema() (*hclspec.Spec, error)
- func (d *MIDIDriverPlugin) DestroyTask(taskID string, force bool) error
- func (d *MIDIDriverPlugin) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)
- func (d *MIDIDriverPlugin) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)
- func (d *MIDIDriverPlugin) InspectTask(taskID string) (*drivers.TaskStatus, error)
- func (d *MIDIDriverPlugin) PluginInfo() (*base.PluginInfoResponse, error)
- func (d *MIDIDriverPlugin) RecoverTask(handle *drivers.TaskHandle) error
- func (d *MIDIDriverPlugin) SetConfig(cfg *base.Config) error
- func (d *MIDIDriverPlugin) SignalTask(taskID string, signal string) error
- func (d *MIDIDriverPlugin) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
- func (d *MIDIDriverPlugin) StopTask(taskID string, timeout time.Duration, signal string) error
- func (d *MIDIDriverPlugin) TaskConfigSchema() (*hclspec.Spec, error)
- func (d *MIDIDriverPlugin) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error)
- func (d *MIDIDriverPlugin) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)
- func (d *MIDIDriverPlugin) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)
- type Player
- type TaskConfig
- type TaskState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteClock ¶
func NewPlugin ¶
func NewPlugin(logger hclog.Logger) drivers.DriverPlugin
NewPlugin returns a new example driver plugin
Types ¶
type Clock ¶
type Clock struct { Name string // contains filtered or unexported fields }
func (*Clock) Unsubscribe ¶
type MIDIDriverPlugin ¶
type MIDIDriverPlugin struct {
// contains filtered or unexported fields
}
MIDIDriverPlugin tasks will play a midi file through a midi port.
func (*MIDIDriverPlugin) Capabilities ¶
func (d *MIDIDriverPlugin) Capabilities() (*drivers.Capabilities, error)
Capabilities returns the features supported by the driver.
func (*MIDIDriverPlugin) ConfigSchema ¶
func (d *MIDIDriverPlugin) ConfigSchema() (*hclspec.Spec, error)
ConfigSchema returns the plugin configuration schema.
func (*MIDIDriverPlugin) DestroyTask ¶
func (d *MIDIDriverPlugin) DestroyTask(taskID string, force bool) error
DestroyTask cleans up and removes a task that has terminated.
func (*MIDIDriverPlugin) ExecTask ¶
func (d *MIDIDriverPlugin) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)
ExecTask returns the result of executing the given command inside a task. This is an optional capability.
func (*MIDIDriverPlugin) Fingerprint ¶
func (d *MIDIDriverPlugin) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)
Fingerprint returns a channel that will be used to send health information and other driver specific node attributes.
func (*MIDIDriverPlugin) InspectTask ¶
func (d *MIDIDriverPlugin) InspectTask(taskID string) (*drivers.TaskStatus, error)
InspectTask returns detailed status information for the referenced taskID.
func (*MIDIDriverPlugin) PluginInfo ¶
func (d *MIDIDriverPlugin) PluginInfo() (*base.PluginInfoResponse, error)
PluginInfo returns information describing the plugin.
func (*MIDIDriverPlugin) RecoverTask ¶
func (d *MIDIDriverPlugin) RecoverTask(handle *drivers.TaskHandle) error
RecoverTask recreates the in-memory state of a task from a TaskHandle.
func (*MIDIDriverPlugin) SetConfig ¶
func (d *MIDIDriverPlugin) SetConfig(cfg *base.Config) error
SetConfig is called by the client to pass the configuration for the plugin.
func (*MIDIDriverPlugin) SignalTask ¶
func (d *MIDIDriverPlugin) SignalTask(taskID string, signal string) error
SignalTask forwards a signal to a task. This is an optional capability.
func (*MIDIDriverPlugin) StartTask ¶
func (d *MIDIDriverPlugin) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
StartTask returns a task handle and a driver network if necessary.
func (*MIDIDriverPlugin) StopTask ¶
StopTask stops a running task with the given signal and within the timeout window.
func (*MIDIDriverPlugin) TaskConfigSchema ¶
func (d *MIDIDriverPlugin) TaskConfigSchema() (*hclspec.Spec, error)
TaskConfigSchema returns the HCL schema for the configuration of a task.
func (*MIDIDriverPlugin) TaskEvents ¶
TaskEvents returns a channel that the plugin can use to emit task related events.
func (*MIDIDriverPlugin) TaskStats ¶
func (d *MIDIDriverPlugin) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)
TaskStats returns a channel which the driver should send stats to at the given interval.
func (*MIDIDriverPlugin) WaitTask ¶
func (d *MIDIDriverPlugin) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)
WaitTask returns a channel used to notify Nomad when a task exits.
type Player ¶
type Player struct { Cfg TaskConfig Tick chan struct{} Done chan struct{} // contains filtered or unexported fields }
func NewPlayer ¶
func NewPlayer(logger hclog.Logger, cfg TaskConfig) *Player
type TaskConfig ¶
type TaskConfig struct { Song string `codec:"song"` MidiFile string `codec:"midi_file"` PortName string `codec:"port_name"` Bars int `codec:"bars"` }
TaskConfig contains configuration information for a task that runs with this plugin
type TaskState ¶
type TaskState struct { ReattachConfig *structs.ReattachConfig TaskConfig *drivers.TaskConfig StartedAt time.Time }
TaskState is the runtime state which is encoded in the handle returned to Nomad client. This information is needed to rebuild the task state and handler during recovery.