Documentation ¶
Overview ¶
Package xfn contains functionality for running Composition Functions.
Index ¶
- type InterceptorCreator
- type Metrics
- type PackagedFunctionRunner
- func (r *PackagedFunctionRunner) GarbageCollectConnections(ctx context.Context, interval time.Duration)
- func (r *PackagedFunctionRunner) GarbageCollectConnectionsNow(ctx context.Context) (int, error)
- func (r *PackagedFunctionRunner) RunFunction(ctx context.Context, name string, req *v1beta1.RunFunctionRequest) (*v1beta1.RunFunctionResponse, error)
- type PackagedFunctionRunnerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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
func (r *PackagedFunctionRunner) RunFunction(ctx context.Context, name string, req *v1beta1.RunFunctionRequest) (*v1beta1.RunFunctionResponse, error)
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 ¶
func WithLogger(l logging.Logger) PackagedFunctionRunnerOption
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.