Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SupportedRuntimes []RuntimeType = []RuntimeType{ Native, NodeJS, Java, Python, }
Functions ¶
func BootCmdForScript ¶
BootCmdForScript returns boot command that is to be used to run config set with name bootName.
func PrependEnvsPrefix ¶
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. Argument `soft` means that operator '?=' is used that only sets env variable if it's not set yet.
Types ¶
type AllCmdConfigs ¶
type AllCmdConfigs struct {
// contains filtered or unexported fields
}
AllCmdConfigs is a result that parsing meta/run.yamls of all required packages yields.
func (*AllCmdConfigs) Add ¶
func (c *AllCmdConfigs) Add(pkgName string, cmdConfig *CmdConfig)
func (*AllCmdConfigs) Persist ¶
func (c *AllCmdConfigs) Persist(mpmDir string) error
type CmdConfig ¶
type CmdConfig struct {
RuntimeType RuntimeType
ConfigSetDefault string
// ConfigSets is a map of available <config-name>:<runtime> pairs.
// The map is built based on meta/run.yaml.
ConfigSets map[string]Runtime
}
CmdConfig is a result that parsing meta/run.yaml yields.
func ParsePackageRunManifestData ¶
ParsePackageRunManifestData returns parsed manifest data.
type CommonRuntime ¶
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, cmdConfs map[string]*CmdConfig, env map[string]string) (string, error)
BuildBootCmd equips runtime-specific bootcmd with common parts.
func (CommonRuntime) GetYamlTemplate ¶
func (r CommonRuntime) GetYamlTemplate() string
func (CommonRuntime) Validate ¶
func (r CommonRuntime) Validate() error
type Runtime ¶
type Runtime interface {
// Validate values that were read from yaml.
Validate() error
// GetBootCmd produces bootcmd based on meta/run.yaml. The cmdConfs
// argument contains CmdConfig objects for all required packages and
// can be used when building boot command.
GetBootCmd(cmdConfs map[string]*CmdConfig, env map[string]string) (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
// 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
}
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 PackageRunManifestGeneral ¶
PackageRunManifestGeneral parses meta/run.yaml file into blank RunConfig. By 'blank' we mean that the struct has no fields populated, but it is of correct type i.e. appropriate implementation of Runtime interface. NOTE: We must differentiate two things regarding Runtime interface implementation:
a) what struct is it implemented with -> e.g. nodeJsRuntime b) what fields is struct populated with -> e.g. nodeJsRuntime.Main For a given meta/run.yaml all config sets get the same (a), but are populated with different values for (b).
NOTE: when Capstan needs to know what packages to require, it needs (a), but
not (b). And this function returns exactly this, (a) without (b).
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" Python RuntimeType = "python" )