runtime

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2017 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedRuntimes []RuntimeType = []RuntimeType{
	Native,
	NodeJS,
	Java,
}

Functions

func BootCmdForScript

func BootCmdForScript(bootName string) string

BootCmdForScript returns boot command that is to be used to run config set with name bootName.

func PrependEnvsPrefix

func PrependEnvsPrefix(cmd string, env map[string]string) (string, error)

PrependEnvsPrefix prepends all key-values of env map to the boot cmd give. It prepends each pair in a form of "--env={KEY}={VALUE}". Also performs check that neither key nor value contains space.

Types

type CommonRuntime

type CommonRuntime struct {
	Env map[string]string `yaml:"env"`
}

CommonRuntime fields are those common to all runtimes. This fields are set for each named-configuration separately, nothing is shared.

func (CommonRuntime) BuildBootCmd

func (r CommonRuntime) BuildBootCmd(bootCmd string) (string, error)

BuildBootCmd equips runtime-specific bootcmd with common parts.

func (CommonRuntime) GetEnv

func (r CommonRuntime) GetEnv() map[string]string

func (CommonRuntime) GetYamlTemplate

func (r CommonRuntime) GetYamlTemplate() string

func (CommonRuntime) Validate

func (r CommonRuntime) Validate() error

type RunConfig

type RunConfig struct {
	InstanceName string
	ImageName    string
	Hypervisor   string
	Verbose      bool
	Memory       string
	Cpus         int
	Networking   string
	Bridge       string
	NatRules     []nat.Rule
	GCEUploadDir string
	MAC          string
	Cmd          string
	Persist      bool
}

type Runtime

type Runtime interface {
	// Validate values that were read from yaml.
	Validate() error

	// GetBootCmd produces bootcmd based on meta/run.yaml.
	GetBootCmd() (string, error)

	// GetRuntimeName returns unique runtime name
	// (use constant from the SupportedRuntimes list)
	GetRuntimeName() string

	// GetRuntimeDescription provides short description about what
	// is this runtime used for, 50 chars
	GetRuntimeDescription() string

	// OnCollect is a callback to run when collecting package
	// (accepts directroy path of the package)
	OnCollect(string) error

	// GetYamlTemplate provides a string containing yaml content with
	// as much help text as possible.
	// NOTE: provide only runtime-specific part of yaml, see runtime/node.go for example.
	// NOTE: Write each comment in its own line for --plain flag to remove it.
	GetYamlTemplate() string

	// GetDependencies returns a list of dependent package names.
	GetDependencies() []string

	// GetEnv returns map of environment variables read from run.yaml.
	GetEnv() map[string]string
}

Runtime interface must be extended for every new runtime. Typically, a runtime struct contains fileds that are expected in meta/run.yaml and implements the functions required by this interface.

func PickRuntime

func PickRuntime(runtimeName RuntimeType) (Runtime, error)

PickRuntime maps runtime name into runtime struct.

type RuntimeType

type RuntimeType string
const (
	Native RuntimeType = "native"
	NodeJS RuntimeType = "node"
	Java   RuntimeType = "java"
)

Jump to

Keyboard shortcuts

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