models

package
v1.2.2-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EngineArguments

type EngineArguments struct {
	EntryPoint           string
	Parameters           []string
	EnvironmentVariables map[string]string
	EntryModule          storage.PreparedStorage
	ImportModules        []storage.PreparedStorage
}

EngineArguments is used to pass pre-processed engine specs to the executor. Currently used to pre-fetch entry and import modules remote resources by the compute node before triggering the executor. TODO: deprecate these arguments once we move remote resources from the engine spec to the upper layer

func DecodeArguments

func DecodeArguments(spec *models.SpecConfig) (*EngineArguments, error)

func (EngineArguments) ToMap

func (c EngineArguments) ToMap() map[string]interface{}

func (EngineArguments) Validate

func (c EngineArguments) Validate() error

type EngineSpec

type EngineSpec struct {
	// EntryModule is a Spec containing the WASM code to start running.
	EntryModule *models.InputSource `json:"EntryModule,omitempty"`

	// Entrypoint is the name of the function in the EntryModule to call to run the job.
	// For WASI jobs, this will should be `_start`, but jobs can choose to call other WASM functions instead.
	// Entrypoint must be a zero-parameter zero-result function.
	Entrypoint string `json:"EntryPoint,omitempty"`

	// Parameters contains arguments supplied to the program (i.e. as ARGV).
	Parameters []string `json:"Parameters,omitempty"`

	// EnvironmentVariables contains variables available in the environment of the running program.
	EnvironmentVariables map[string]string `json:"EnvironmentVariables,omitempty"`

	// ImportModules is a slice of StorageSpec's containing WASM modules whose exports will be available as imports
	// to the EntryModule.
	ImportModules []*models.InputSource `json:"ImportModules,omitempty"`
}

EngineSpec contains necessary parameters to execute a wasm job.

func DecodeLegacySpec

func DecodeLegacySpec(spec *models.SpecConfig) (EngineSpec, error)

func DecodeSpec

func DecodeSpec(spec *models.SpecConfig) (EngineSpec, error)

func (EngineSpec) ToArguments

func (c EngineSpec) ToArguments(entryModule storage.PreparedStorage, importModules ...storage.PreparedStorage) EngineArguments

ToArguments returns EngineArguments from the spec

func (EngineSpec) ToMap

func (c EngineSpec) ToMap() map[string]interface{}

func (EngineSpec) Validate

func (c EngineSpec) Validate() error

Jump to

Keyboard shortcuts

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