extensions

package
v1.45.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package extensions consumes extensions in stencil

Index

Constants

This section is empty.

Variables

View Source
var ErrFirstArgNotString = errors.New("expected first arg to be type string")

ErrFirstArgNotString is returned when the first argument to Call is not a string.

View Source
var ErrFunctionNotProvided = errors.New("extension doesn't provide function")

ErrFunctionNotProvided is returned when an extension does not provide the requested function.

View Source
var ErrNoArgs = errors.New("expected at least 1 arg")

ErrNoArgs is returned when Call is invoked without any arguments.

View Source
var ErrTooManyArguments = errors.New("too many arguments")

ErrTooManyArguments is returned when a template function is called with more arguments than it accepts.

View Source
var ErrUnknownExtension = errors.New("unknown extension")

ErrUnknownExtension is returned when the requested extension is not registered.

Functions

This section is empty.

Types

type ExtensionCaller

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

ExtensionCaller calls extension functions.

func (*ExtensionCaller) Call

func (ec *ExtensionCaller) Call(args ...any) (any, error)

Call returns a function based on its path, e.g. test.callFunction.

type Host

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

Host implements an extension host that handles registering extensions and executing them.

func NewHost

func NewHost(log logrus.FieldLogger) *Host

NewHost creates a new extension host.

func (*Host) Close added in v1.26.0

func (h *Host) Close() error

Close terminates the extension host, which in turn stops all current native extensions.

func (*Host) GetExtensionCaller

func (h *Host) GetExtensionCaller(ctx context.Context) (*ExtensionCaller, error)

GetExtensionCaller returns an extension caller that's aware of all extension functions.

func (*Host) RegisterExtension

func (h *Host) RegisterExtension(ctx context.Context, source, name string, version *resolver.Version) error

RegisterExtension registers a ext from a given source and compiles/downloads it. A client is then created that is able to communicate with the ext.

func (*Host) RegisterInprocExtension added in v1.20.0

func (h *Host) RegisterInprocExtension(name string, ext apiv1.Implementation)

RegisterInprocExtension registers an extension that is implemented within the same process directly with the host. Please limit the use of this API for unit testing only!

Directories

Path Synopsis
Package apiv1 implements the bridge between a extension and go-plugin providing most of the implementation for the extension if it's written in Go.
Package apiv1 implements the bridge between a extension and go-plugin providing most of the implementation for the extension if it's written in Go.

Jump to

Keyboard shortcuts

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