Documentation ¶
Index ¶
- Constants
- func NewPlugin(logger hclog.Logger) drivers.DriverPlugin
- type Config
- type EntityStatus
- type MinecraftClient
- func (c MinecraftClient) CreateBlock() error
- func (c MinecraftClient) DescribeEntity(ctx context.Context, entity string, id string) (*EntityStatus, error)
- func (c MinecraftClient) DestroyBlock() error
- func (c MinecraftClient) RemoveEntity(ctx context.Context, entity string, id string) error
- func (c MinecraftClient) SummonEntity(ctx context.Context, entity string, position string, id string) error
- type MinecraftClientInterface
- type MinecraftDriverPlugin
- func (d *MinecraftDriverPlugin) Capabilities() (*drivers.Capabilities, error)
- func (d *MinecraftDriverPlugin) ConfigSchema() (*hclspec.Spec, error)
- func (d *MinecraftDriverPlugin) DestroyTask(taskID string, force bool) error
- func (d *MinecraftDriverPlugin) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)
- func (d *MinecraftDriverPlugin) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)
- func (d *MinecraftDriverPlugin) InspectTask(taskID string) (*drivers.TaskStatus, error)
- func (d *MinecraftDriverPlugin) PluginInfo() (*base.PluginInfoResponse, error)
- func (d *MinecraftDriverPlugin) RecoverTask(handle *drivers.TaskHandle) error
- func (d *MinecraftDriverPlugin) SetConfig(cfg *base.Config) error
- func (d *MinecraftDriverPlugin) SignalTask(taskID string, signal string) error
- func (d *MinecraftDriverPlugin) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
- func (d *MinecraftDriverPlugin) StopTask(taskID string, timeout time.Duration, signal string) error
- func (d *MinecraftDriverPlugin) TaskConfigSchema() (*hclspec.Spec, error)
- func (d *MinecraftDriverPlugin) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error)
- func (d *MinecraftDriverPlugin) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)
- func (d *MinecraftDriverPlugin) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)
- type TaskConfig
- type TaskState
Constants ¶
const (
NoEntityFoundErr = "No entity was found"
)
Variables ¶
This section is empty.
Functions ¶
func NewPlugin ¶
func NewPlugin(logger hclog.Logger) drivers.DriverPlugin
NewPlugin returns a new example driver plugin
Types ¶
type EntityStatus ¶
type MinecraftClient ¶
type MinecraftClient struct {
// contains filtered or unexported fields
}
func (MinecraftClient) CreateBlock ¶
func (c MinecraftClient) CreateBlock() error
func (MinecraftClient) DescribeEntity ¶
func (c MinecraftClient) DescribeEntity(ctx context.Context, entity string, id string) (*EntityStatus, error)
func (MinecraftClient) DestroyBlock ¶
func (c MinecraftClient) DestroyBlock() error
func (MinecraftClient) RemoveEntity ¶
func (MinecraftClient) SummonEntity ¶
type MinecraftClientInterface ¶
type MinecraftClientInterface interface { CreateBlock() error DestroyBlock() error SummonEntity(ctx context.Context, entity string, position string, id string) error RemoveEntity(ctx context.Context, entity string, id string) error DescribeEntity(ctx context.Context, entity string, id string) (*EntityStatus, error) }
type MinecraftDriverPlugin ¶
type MinecraftDriverPlugin struct {
// contains filtered or unexported fields
}
HelloDriverPlugin is an example driver plugin. When provisioned in a job, the taks will output a greet specified by the user.
func (*MinecraftDriverPlugin) Capabilities ¶
func (d *MinecraftDriverPlugin) Capabilities() (*drivers.Capabilities, error)
Capabilities returns the features supported by the driver.
func (*MinecraftDriverPlugin) ConfigSchema ¶
func (d *MinecraftDriverPlugin) ConfigSchema() (*hclspec.Spec, error)
ConfigSchema returns the plugin configuration schema.
func (*MinecraftDriverPlugin) DestroyTask ¶
func (d *MinecraftDriverPlugin) DestroyTask(taskID string, force bool) error
DestroyTask cleans up and removes a task that has terminated.
func (*MinecraftDriverPlugin) ExecTask ¶
func (d *MinecraftDriverPlugin) 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 (*MinecraftDriverPlugin) Fingerprint ¶
func (d *MinecraftDriverPlugin) 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 (*MinecraftDriverPlugin) InspectTask ¶
func (d *MinecraftDriverPlugin) InspectTask(taskID string) (*drivers.TaskStatus, error)
InspectTask returns detailed status information for the referenced taskID.
func (*MinecraftDriverPlugin) PluginInfo ¶
func (d *MinecraftDriverPlugin) PluginInfo() (*base.PluginInfoResponse, error)
PluginInfo returns information describing the plugin.
func (*MinecraftDriverPlugin) RecoverTask ¶
func (d *MinecraftDriverPlugin) RecoverTask(handle *drivers.TaskHandle) error
RecoverTask recreates the in-memory state of a task from a TaskHandle.
func (*MinecraftDriverPlugin) SetConfig ¶
func (d *MinecraftDriverPlugin) SetConfig(cfg *base.Config) error
SetConfig is called by the client to pass the configuration for the plugin.
func (*MinecraftDriverPlugin) SignalTask ¶
func (d *MinecraftDriverPlugin) SignalTask(taskID string, signal string) error
SignalTask forwards a signal to a task. This is an optional capability.
func (*MinecraftDriverPlugin) StartTask ¶
func (d *MinecraftDriverPlugin) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
StartTask returns a task handle and a driver network if necessary.
func (*MinecraftDriverPlugin) StopTask ¶
StopTask stops a running task with the given signal and within the timeout window.
func (*MinecraftDriverPlugin) TaskConfigSchema ¶
func (d *MinecraftDriverPlugin) TaskConfigSchema() (*hclspec.Spec, error)
TaskConfigSchema returns the HCL schema for the configuration of a task.
func (*MinecraftDriverPlugin) TaskEvents ¶
TaskEvents returns a channel that the plugin can use to emit task related events.
func (*MinecraftDriverPlugin) TaskStats ¶
func (d *MinecraftDriverPlugin) 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 (*MinecraftDriverPlugin) WaitTask ¶
func (d *MinecraftDriverPlugin) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)
WaitTask returns a channel used to notify Nomad when a task exits.
type TaskConfig ¶
type TaskConfig struct { ID string `codec:"id"` Entity string `codec:"entity"` Position string `codec:"position"` }
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 // TODO: add any extra important values that must be persisted in order // to restore a task. // // The plugin keeps track of its running tasks in a in-memory data // structure. If the plugin crashes, this data will be lost, so Nomad // will respawn a new instance of the plugin and try to restore its // in-memory representation of the running tasks using the RecoverTask() // method below. ID string Entity string Position string }
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.