xfn

package
v1.18.5 Latest Latest
Warning

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

Go to latest
Published: May 1, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package xfn contains functionality for running Composition Functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BetaFallBackFunctionRunnerServiceClient added in v1.17.0

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

A BetaFallBackFunctionRunnerServiceClient tries to send a v1 RPC. If the server reports that v1 is unimplemented, it falls back to sending a v1beta1 RPC. It translates the v1 RunFunctionRequest to v1beta1 by round-tripping it through protobuf encoding. This works because the two messages are guaranteed to be identical - the v1beta1 proto is replicated from the v1 proto.

func NewBetaFallBackFunctionRunnerServiceClient added in v1.17.0

func NewBetaFallBackFunctionRunnerServiceClient(cc *grpc.ClientConn) *BetaFallBackFunctionRunnerServiceClient

NewBetaFallBackFunctionRunnerServiceClient returns a client that falls back to v1beta1 when v1 is unimplemented.

func (*BetaFallBackFunctionRunnerServiceClient) RunFunction added in v1.17.0

RunFunction tries to send a v1 RunFunctionRequest. It falls back to v1beta1 if the v1 service is unimplemented.

type InterceptorCreator added in v1.15.0

type InterceptorCreator interface {
	// CreateInterceptor creates an interceptor for the named function. It also
	// accepts the function's package OCI reference, which may be used by the
	// interceptor (e.g. to label metrics).
	CreateInterceptor(name, pkg string) grpc.UnaryClientInterceptor
}

An InterceptorCreator creates gRPC UnaryClientInterceptors for functions.

type Metrics added in v1.15.0

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

Metrics are requests, errors, and duration (RED) metrics for composition function runs.

func NewMetrics added in v1.15.0

func NewMetrics() *Metrics

NewMetrics creates metrics for composition function runs.

func (*Metrics) Collect added in v1.15.0

func (m *Metrics) Collect(ch chan<- prometheus.Metric)

Collect is called by the Prometheus registry when collecting metrics. The implementation sends each collected metric via the provided channel and returns once the last metric has been sent.

func (*Metrics) CreateInterceptor added in v1.15.0

func (m *Metrics) CreateInterceptor(name, pkg string) grpc.UnaryClientInterceptor

CreateInterceptor returns a gRPC UnaryClientInterceptor for the named function. The supplied package (pkg) should be the package's OCI reference.

func (*Metrics) Describe added in v1.15.0

func (m *Metrics) Describe(ch chan<- *prometheus.Desc)

Describe sends the super-set of all possible descriptors of metrics collected by this Collector to the provided channel and returns once the last descriptor has been sent.

type PackagedFunctionRunner added in v1.14.0

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

A PackagedFunctionRunner runs a Function by making a gRPC call to a Function package's runtime. It creates a gRPC client connection for each Function. The Function's endpoint is determined by reading the status.endpoint of the active FunctionRevision. You must call GarbageCollectClientConnections in order to ensure connections are properly closed.

func NewPackagedFunctionRunner added in v1.14.0

func NewPackagedFunctionRunner(c client.Reader, o ...PackagedFunctionRunnerOption) *PackagedFunctionRunner

NewPackagedFunctionRunner returns a FunctionRunner that runs a Function by making a gRPC call to a Function package's runtime.

func (*PackagedFunctionRunner) GarbageCollectConnections added in v1.14.0

func (r *PackagedFunctionRunner) GarbageCollectConnections(ctx context.Context, interval time.Duration)

GarbageCollectConnections runs every interval until the supplied context is cancelled. It garbage collects gRPC client connections to Functions that are no longer installed.

func (*PackagedFunctionRunner) GarbageCollectConnectionsNow added in v1.14.0

func (r *PackagedFunctionRunner) GarbageCollectConnectionsNow(ctx context.Context) (int, error)

GarbageCollectConnectionsNow immediately garbage collects any gRPC client connections to Functions that are no longer installed. It returns the number of connections garbage collected.

func (*PackagedFunctionRunner) RunFunction added in v1.14.0

RunFunction sends the supplied RunFunctionRequest to the named Function. The function is expected to be an installed Function.pkg.crossplane.io package.

type PackagedFunctionRunnerOption added in v1.14.0

type PackagedFunctionRunnerOption func(r *PackagedFunctionRunner)

A PackagedFunctionRunnerOption configures a PackagedFunctionRunner.

func WithInterceptorCreators added in v1.15.0

func WithInterceptorCreators(ics ...InterceptorCreator) PackagedFunctionRunnerOption

WithInterceptorCreators configures the interceptors the PackagedFunctionRunner should create for each function.

func WithLogger

WithLogger configures the logger the PackagedFunctionRunner should use.

func WithTLSConfig added in v1.14.0

func WithTLSConfig(cfg *tls.Config) PackagedFunctionRunnerOption

WithTLSConfig configures the client TLS the PackagedFunctionRunner should use.

Jump to

Keyboard shortcuts

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