drivers

package
v0.0.0-...-dfdfe39 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHostIsNotRunning = errors.New("Host is not running")
View Source
var ErrNotImplemented = errors.New("Not Implemented")

Functions

func MachineInState

func MachineInState(d Driver, desiredState state.State) func() bool

Types

type BaseDriver

type BaseDriver struct {
	IPAddress   string
	MachineName string
	StorePath   string
	BundleName  string
}

BaseDriver - Embed this struct into drivers to provide the common set of fields and functions.

func (*BaseDriver) DriverName

func (d *BaseDriver) DriverName() string

DriverName returns the name of the driver

func (*BaseDriver) DriverVersion

func (d *BaseDriver) DriverVersion() string

DriverName returns the name of the driver

func (*BaseDriver) GetBundleName

func (d *BaseDriver) GetBundleName() (string, error)

Returns the name of the bundle which was used to create this machine

func (*BaseDriver) GetIP

func (d *BaseDriver) GetIP() (string, error)

GetIP returns the ip

func (*BaseDriver) GetMachineName

func (d *BaseDriver) GetMachineName() string

GetMachineName returns the machine name

func (*BaseDriver) PreCreateCheck

func (d *BaseDriver) PreCreateCheck() error

PreCreateCheck is called to enforce pre-creation steps

func (*BaseDriver) ResolveStorePath

func (d *BaseDriver) ResolveStorePath(file string) string

ResolveStorePath returns the store path where the machine is

func (*BaseDriver) UpdateConfigRaw

func (d *BaseDriver) UpdateConfigRaw(rawData []byte) error

type Driver

type Driver interface {
	// Create a host using the driver's config
	Create() error

	// DriverName returns the name of the driver
	DriverName() string

	// GetIP returns an IP or hostname that this host is available at
	// e.g. 1.2.3.4 or docker-host-d60b70a14d3a.cloudapp.net
	GetIP() (string, error)

	// GetMachineName returns the name of the machine
	GetMachineName() string

	// GetBundleName() Returns the name of the unpacked bundle which was used to create this machine
	GetBundleName() (string, error)

	// GetState returns the state that the host is in (running, stopped, etc)
	GetState() (state.State, error)

	// Kill stops a host forcefully
	Kill() error

	// PreCreateCheck allows for pre-create operations to make sure a driver is ready for creation
	PreCreateCheck() error

	// Remove a host
	Remove() error

	// UpdateConfigRaw allows to change the state (memory, ...) of an already created machine
	UpdateConfigRaw(rawDriver []byte) error

	// Start a host
	Start() error

	// Stop a host gracefully
	Stop() error

	// Get Version information
	DriverVersion() string
}

Driver defines how a host is created and controlled. Different types of driver represent different ways hosts can be created (e.g. different hypervisors, different cloud providers)

type VMDriver

type VMDriver struct {
	*BaseDriver
	ImageSourcePath string
	ImageFormat     string
	Memory          int
	CPU             int
	DiskCapacity    uint64 // bytes
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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