functions

package
v0.112.1-nightly Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildCmd = &cobra.Command{
	Use:   "build [directory]",
	Short: "Build a function to WASM using TinyGo",
	Long: `Compiles function.go in the given directory (or current directory) to a WASM binary.
Requires TinyGo to be installed (https://tinygo.org/getting-started/install/).`,
	Args: cobra.MaximumNArgs(1),
	RunE: runBuild,
}

BuildCmd compiles a function to WASM using TinyGo.

View Source
var DeleteCmd = &cobra.Command{
	Use:   "delete <name>",
	Short: "Delete a deployed function",
	Long:  "Deletes a function from the Orama Network. This action cannot be undone.",
	Args:  cobra.ExactArgs(1),
	RunE:  runDelete,
}

DeleteCmd deletes a deployed function.

View Source
var DeployCmd = &cobra.Command{
	Use:   "deploy [directory]",
	Short: "Deploy a function to the Orama Network",
	Long: `Deploys the function in the given directory (or current directory).
If no .wasm file exists, it will be built automatically using TinyGo.
Reads configuration from function.yaml.`,
	Args: cobra.MaximumNArgs(1),
	RunE: runDeploy,
}

DeployCmd deploys a function to the Orama Network.

View Source
var GetCmd = &cobra.Command{
	Use:   "get <name>",
	Short: "Get details of a deployed function",
	Long:  "Retrieves and displays detailed information about a specific function.",
	Args:  cobra.ExactArgs(1),
	RunE:  runGet,
}

GetCmd shows details of a deployed function.

View Source
var InitCmd = &cobra.Command{
	Use:   "init <name>",
	Short: "Create a new serverless function project",
	Long:  "Scaffolds a new directory with function.go and function.yaml templates.",
	Args:  cobra.ExactArgs(1),
	RunE:  runInit,
}

InitCmd scaffolds a new function project.

View Source
var InvokeCmd = &cobra.Command{
	Use:   "invoke <name>",
	Short: "Invoke a deployed function",
	Long:  "Sends a request to invoke the named function with optional JSON payload.",
	Args:  cobra.ExactArgs(1),
	RunE:  runInvoke,
}

InvokeCmd invokes a deployed function.

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "List deployed functions",
	Long:  "Lists all functions deployed in the current namespace.",
	Args:  cobra.NoArgs,
	RunE:  runList,
}

ListCmd lists all deployed functions.

View Source
var LogsCmd = &cobra.Command{
	Use:   "logs <name>",
	Short: "Get execution logs for a function",
	Long:  "Retrieves the most recent execution logs for a deployed function.",
	Args:  cobra.ExactArgs(1),
	RunE:  runLogs,
}

LogsCmd retrieves function execution logs.

View Source
var VersionsCmd = &cobra.Command{
	Use:   "versions <name>",
	Short: "List all versions of a function",
	Long:  "Shows all deployed versions of a specific function.",
	Args:  cobra.ExactArgs(1),
	RunE:  runVersions,
}

VersionsCmd lists all versions of a function.

Functions

func ResolveFunctionDir

func ResolveFunctionDir(dir string) (string, error)

ResolveFunctionDir resolves and validates a function directory. If dir is empty, uses the current working directory.

func ValidateWASM

func ValidateWASM(data []byte) error

ValidateWASM checks that the given bytes are a valid WASM binary (magic number check).

func ValidateWASMFile

func ValidateWASMFile(path string) error

ValidateWASMFile checks that the file at the given path is a valid WASM binary.

Types

type FunctionConfig

type FunctionConfig struct {
	Name    string            `yaml:"name"`
	Public  bool              `yaml:"public"`
	Memory  int               `yaml:"memory"`
	Timeout int               `yaml:"timeout"`
	Retry   RetryConfig       `yaml:"retry"`
	Env     map[string]string `yaml:"env"`
}

FunctionConfig represents the function.yaml configuration.

func LoadConfig

func LoadConfig(dir string) (*FunctionConfig, error)

LoadConfig reads and parses a function.yaml from the given directory.

type RetryConfig

type RetryConfig struct {
	Count int `yaml:"count"`
	Delay int `yaml:"delay"`
}

RetryConfig holds retry settings.

Jump to

Keyboard shortcuts

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