simulator

package
v0.0.0-...-a355528 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Kind is the canonical name of the plugin for starting up, etc.
	Kind = "simulator"

	// EnvStore is the enviornment variable to control the backend to use. e.g. 'mem', 'file'
	EnvStore = "mem"

	// EnvDir is the env for directory for file storage
	EnvDir = "INFRAKIT_SIMULATOR_DIR"

	// EnvInstanceTypes is the env var to set for the instance spi type names (comma-delimited)
	EnvInstanceTypes = "INFRAKIT_SIMULATOR_INSTANCE_TYPES"

	// EnvL4Names is the env var to set for the L4 name
	EnvL4Names = "INFRAKIT_SIMULATOR_L4_NAMES"

	// StoreMem is the value for using memory store
	StoreMem = "mem"

	// StoreFile is the value for using file store
	StoreFile = "file"
)

Variables

View Source
var DefaultOptions = Options{
	Store:         local.Getenv(EnvStore, "mem"),
	Dir:           local.Getenv(EnvDir, filepath.Join(local.InfrakitHome(), "simulator")),
	InstanceTypes: strings.Split(local.Getenv(EnvInstanceTypes, "compute,net,disk"), ","),
	L4Names:       strings.Split(local.Getenv(EnvL4Names, "lb1,lb2,lb3"), ","),
}

DefaultOptions return an Options with default values filled in.

Functions

func NewInstance

func NewInstance(name string, options Options) instance.Plugin

NewInstance returns a typed instance plugin

func NewL4

func NewL4(name string, options Options) loadbalancer.L4

NewL4 returns a L4 loadbalancer

func Run

func Run(plugins func() discovery.Plugins, name plugin.Name,
	config *types.Any) (transport plugin.Transport, impls map[run.PluginCode]interface{}, onStop func(), err error)

Run runs the plugin, blocking the current thread. Error is returned immediately if the plugin cannot be started.

Types

type Options

type Options struct {
	Store         string
	Dir           string
	InstanceTypes []string
	L4Names       []string
}

Options capture the options for starting up the plugin.

Jump to

Keyboard shortcuts

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