functions

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package functions contains functions for building embedded functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildContext

type BuildContext struct {
	// ProjectFS is the project root filesystem.
	ProjectFS afero.Fs
	// FunctionPath is the function's path relative to ProjectFS root,
	// e.g. "functions/my-fn".
	FunctionPath string
	// SchemasPath is the schemas dir relative to ProjectFS root, e.g.
	// "schemas". Used by Python to stage schemas/python/ alongside the
	// function source so the relative path-dep resolves at build time.
	SchemasPath string
	// Architectures is the list of architectures to build for.
	Architectures []string
	// OSBasePath is the absolute on-disk path of the function directory.
	// Used by FSToTar to resolve symlinks.
	OSBasePath string
}

BuildContext bundles the inputs that function builders work from. Each builder slices the parts of the project it needs: the function subdirectory for Go/KCL/go-templating, plus the schemas dir for Python.

func (BuildContext) FunctionFS

func (c BuildContext) FunctionFS() afero.Fs

FunctionFS returns a filesystem rooted at the function's source directory.

type Builder

type Builder interface {
	// Name returns a name for this builder.
	Name() string
	// Build builds the function described by the given context, returning
	// an image for each architecture. This image will *not* include
	// package metadata; it's just the runtime image for the function.
	Build(ctx context.Context, c BuildContext) ([]v1.Image, error)
	// contains filtered or unexported methods
}

Builder knows how to build a particular kind of function.

type Identifier

type Identifier interface {
	// Identify returns a suitable builder for the function whose source lives
	// in the given filesystem. It returns an error if no such builder is
	// available.
	Identify(fromFS afero.Fs, imageConfigs []pkgv1beta1.ImageConfig) (Builder, error)
}

Identifier knows how to identify an appropriate builder for a function based on its source code.

var DefaultIdentifier Identifier = realIdentifier{}

DefaultIdentifier is the default builder identifier, suitable for production use.

var FakeIdentifier Identifier = nopIdentifier{}

FakeIdentifier is an identifier that always returns a fake builder. This is for use in tests where we don't want to do real builds.

Jump to

Keyboard shortcuts

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