internal

package
v0.405.3 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallMetadataFromContext added in v0.337.0

func CallMetadataFromContext(ctx context.Context) map[MetadataKey]string

CallMetadataFromContext returns the call metadata from the context.

func ContextWithCallMetadata added in v0.337.0

func ContextWithCallMetadata(ctx context.Context, metadata map[MetadataKey]string) context.Context

ContextWithCallMetadata returns a new context with the call metadata.

func WithContext

func WithContext(ctx context.Context, ftl FTL) context.Context

WithContext returns a new context with the FTL instance.

Types

type FTL

type FTL interface {
	// PublishEvent sends an event to a pubsub topic.
	PublishEvent(ctx context.Context, topic *schema.Ref, event any) error

	// CallMap calls Get on an instance of an ftl.Map.
	//
	// "mapper" is a pointer to an instance of an ftl.MapHandle. "value" is the
	// value being mapped. "mapImpl" is a function that will be called to
	// compute the mapped value.
	CallMap(ctx context.Context, mapper any, value any, mapImpl func(context.Context) (any, error)) any

	// GetConfig unmarshals a configuration value into dest.
	GetConfig(ctx context.Context, name string, dest any) error

	// GetSecret unmarshals a secret value into dest.
	GetSecret(ctx context.Context, name string, dest any) error
}

FTL is the interface that the FTL runtime provides to user code.

In production, the FTL runtime will provide an implementation of this interface that communicates with the Controller over gRPC.

In testing code, the implementation will inject fakes and other test implementations.

func FromContext

func FromContext(ctx context.Context) FTL

FromContext returns the FTL instance from the context.

type MetadataKey added in v0.337.0

type MetadataKey string

type RealFTL

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

RealFTL is the real implementation of the internal.FTL interface using the Controller.

func New

New creates a new RealFTL

func (*RealFTL) CallMap added in v0.243.0

func (r *RealFTL) CallMap(ctx context.Context, mapper any, value any, mapImpl func(context.Context) (any, error)) any

func (*RealFTL) GetConfig added in v0.248.0

func (r *RealFTL) GetConfig(_ context.Context, name string, dest any) error

func (*RealFTL) GetSecret added in v0.248.1

func (r *RealFTL) GetSecret(_ context.Context, name string, dest any) error

func (*RealFTL) PublishEvent added in v0.239.0

func (r *RealFTL) PublishEvent(ctx context.Context, topic *schema.Ref, event any) error

Jump to

Keyboard shortcuts

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