models

package
v1.5.0-alpha12 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 6 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 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

type WasmEngineBuilder added in v1.4.0

type WasmEngineBuilder struct {
	// contains filtered or unexported fields
}

func NewWasmEngineBuilder added in v1.4.0

func NewWasmEngineBuilder(entryModule *models.InputSource) *WasmEngineBuilder

func (*WasmEngineBuilder) Build added in v1.4.0

func (b *WasmEngineBuilder) Build() (*models.SpecConfig, error)

func (*WasmEngineBuilder) MustBuild added in v1.5.0

func (b *WasmEngineBuilder) MustBuild() *models.SpecConfig

func (*WasmEngineBuilder) WithEntrypoint added in v1.4.0

func (b *WasmEngineBuilder) WithEntrypoint(e string) *WasmEngineBuilder

func (*WasmEngineBuilder) WithEnvironmentVariables added in v1.4.0

func (b *WasmEngineBuilder) WithEnvironmentVariables(e map[string]string) *WasmEngineBuilder

func (*WasmEngineBuilder) WithImportModules added in v1.4.0

func (b *WasmEngineBuilder) WithImportModules(e []*models.InputSource) *WasmEngineBuilder

func (*WasmEngineBuilder) WithParameters added in v1.4.0

func (b *WasmEngineBuilder) WithParameters(e ...string) *WasmEngineBuilder

Jump to

Keyboard shortcuts

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