Documentation
¶
Index ¶
- Variables
- func NewPlugin(logger hclog.Logger) drivers.DriverPlugin
- type TaskState
- type VirtDriverPlugin
- func (d *VirtDriverPlugin) Capabilities() (*drivers.Capabilities, error)
- func (d *VirtDriverPlugin) ConfigSchema() (*hclspec.Spec, error)
- func (d *VirtDriverPlugin) DestroyTask(taskID string, force bool) error
- func (d *VirtDriverPlugin) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)
- func (d *VirtDriverPlugin) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)
- func (d *VirtDriverPlugin) InspectTask(taskID string) (*drivers.TaskStatus, error)
- func (d *VirtDriverPlugin) PluginInfo() (*base.PluginInfoResponse, error)
- func (d *VirtDriverPlugin) RecoverTask(handle *drivers.TaskHandle) error
- func (d *VirtDriverPlugin) SetConfig(cfg *base.Config) error
- func (d *VirtDriverPlugin) SignalTask(taskID string, signal string) error
- func (d *VirtDriverPlugin) StartTask(cfg *drivers.TaskConfig) (_ *drivers.TaskHandle, _ *drivers.DriverNetwork, err error)
- func (d *VirtDriverPlugin) StopTask(taskID string, timeout time.Duration, signal string) error
- func (d *VirtDriverPlugin) TaskConfigSchema() (*hclspec.Spec, error)
- func (d *VirtDriverPlugin) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error)
- func (d *VirtDriverPlugin) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)
- func (d *VirtDriverPlugin) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type TaskState ¶
type TaskState struct {
TaskConfig *drivers.TaskConfig
StartedAt time.Time
// NetTeardown is the specification used to delete all the network
// configuration associated to a VM.
NetTeardown *net.TeardownSpec
}
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.
type VirtDriverPlugin ¶
type VirtDriverPlugin struct {
// contains filtered or unexported fields
}
func (*VirtDriverPlugin) Capabilities ¶
func (d *VirtDriverPlugin) Capabilities() (*drivers.Capabilities, error)
Capabilities returns the features supported by the driver.
func (*VirtDriverPlugin) ConfigSchema ¶
func (d *VirtDriverPlugin) ConfigSchema() (*hclspec.Spec, error)
ConfigSchema returns the plugin configuration schema.
func (*VirtDriverPlugin) DestroyTask ¶
func (d *VirtDriverPlugin) DestroyTask(taskID string, force bool) error
DestroyTask function cleans up and removes a task that has terminated. If force is set to true, the driver must destroy the task even if it is still running.
func (*VirtDriverPlugin) ExecTask ¶
func (d *VirtDriverPlugin) 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, currently not supported by the virt driver.
func (*VirtDriverPlugin) Fingerprint ¶
func (d *VirtDriverPlugin) 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 (*VirtDriverPlugin) InspectTask ¶
func (d *VirtDriverPlugin) InspectTask(taskID string) (*drivers.TaskStatus, error)
InspectTask returns detailed status information for the referenced taskID.
func (*VirtDriverPlugin) PluginInfo ¶
func (d *VirtDriverPlugin) PluginInfo() (*base.PluginInfoResponse, error)
PluginInfo returns information describing the plugin.
func (*VirtDriverPlugin) RecoverTask ¶
func (d *VirtDriverPlugin) RecoverTask(handle *drivers.TaskHandle) error
RecoverTask recreates the in-memory state of a task from a TaskHandle.
func (*VirtDriverPlugin) SetConfig ¶
func (d *VirtDriverPlugin) SetConfig(cfg *base.Config) error
SetConfig is called by the client to pass the configuration for the plugin.
func (*VirtDriverPlugin) SignalTask ¶
func (d *VirtDriverPlugin) SignalTask(taskID string, signal string) error
SignalTask forwards a signal to a task. This is an optional capability, currently not supported by the virt driver.
func (*VirtDriverPlugin) StartTask ¶
func (d *VirtDriverPlugin) StartTask(cfg *drivers.TaskConfig) (_ *drivers.TaskHandle, _ *drivers.DriverNetwork, err error)
StartTask returns a task handle and a driver network if necessary.
func (*VirtDriverPlugin) StopTask ¶
StopTask function is expected to stop a running task by sending the given signal to it. If the task does not stop during the given timeout, the driver must forcefully kill the task. StopTask does not clean up resources of the task or remove it from the driver's internal state.
func (*VirtDriverPlugin) TaskConfigSchema ¶
func (d *VirtDriverPlugin) TaskConfigSchema() (*hclspec.Spec, error)
TaskConfigSchema returns the HCL schema for the configuration of a task.
func (*VirtDriverPlugin) TaskEvents ¶
TaskEvents returns a channel that the plugin can use to emit task related events.
func (*VirtDriverPlugin) TaskStats ¶
func (d *VirtDriverPlugin) 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 (*VirtDriverPlugin) WaitTask ¶
func (d *VirtDriverPlugin) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)
WaitTask function is expected to return a channel that will send an *ExitResult when the task exits or close the channel when the context is canceled. It is also expected that calling WaitTask on an exited task will immediately send an *ExitResult on the returned channel. A call to WaitTask after StopTask is valid and should be handled. If WaitTask is called after DestroyTask, it should return drivers.ErrTaskNotFound as no task state should exist after DestroyTask is called.