driver

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2020 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverLoading = iota
	DriverReloading
	DriverAlive
	DriverFailed
)

DriverStates represents driver states.

Variables

View Source
var BuiltinPath string

BuiltinPath is the path where the builtin drivers are kept. It will try using $HONEYDIPPER_DRIVERS_BUILTIN by default. If $HONEYDIPPER_DRIVERS_BUILTIN is not set, will try using $GOPATH/bin. If $GOPATH is not defined, use "/opt/honeydipper/driver/builtin".

Functions

This section is empty.

Types

type BuiltinDriver added in v0.1.8

type BuiltinDriver struct {
	// contains filtered or unexported fields
}

BuiltinDriver are compiled and delivered with daemon binary in the same container image

func NewBuiltinDriver added in v0.1.8

func NewBuiltinDriver(m *Meta) *BuiltinDriver

NewBuiltinDriver creates a handler for the builtin driver specified in the meta info.

func (*BuiltinDriver) Acquire added in v0.1.8

func (d *BuiltinDriver) Acquire()

Acquire function is used for getting the driver from sources and validate, for builtin drivers, just make sure the name is valid.

func (*BuiltinDriver) Meta added in v0.1.8

func (d *BuiltinDriver) Meta() *Meta

Meta function exposes the metadata used for this driver handler

func (*BuiltinDriver) Prepare added in v0.1.8

func (d *BuiltinDriver) Prepare()

Prepare function is used for preparing the arguments when calling the executable for the driver.

type Handler

type Handler interface {
	Acquire()
	Prepare()
	Meta() *Meta
}

Handler provides common functions for handling a driver

func NewDriver

func NewDriver(data map[string]interface{}) Handler

NewDriver creates a driver object to represent a child process.

type Meta added in v0.1.8

type Meta struct {
	Name        string
	Type        string
	Executable  string
	Arguments   []string
	HandlerData map[string]interface{}
}

Meta holds the meta information about the driver itself.

type Runtime

type Runtime struct {
	Data        interface{}
	DynamicData interface{}
	Feature     string
	Stream      chan dipper.Message
	Input       io.ReadCloser
	Output      io.WriteCloser
	Service     string
	Run         *exec.Cmd
	State       int
	Handler     Handler
}

Runtime contains the runtime information of the running driver.

func (*Runtime) SendMessage

func (runtime *Runtime) SendMessage(msg *dipper.Message)

SendMessage sentds a dipper message to the driver child process.

func (*Runtime) SendOptions

func (runtime *Runtime) SendOptions()

SendOptions sends driver options and data to the child process as a dipper message.

func (*Runtime) Start

func (runtime *Runtime) Start(service string)

Start the driver child process. The "service" indicates which service this driver belongs to.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL