internal

package
v0.242.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 {
	// FSMSend sends an event to an instance of an FSM.
	FSMSend(ctx context.Context, fsm, instance string, data any) error

	// PublishEvent sends an event to a pubsub topic.
	PublishEvent(ctx context.Context, topic string, event 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 RealFTL

type RealFTL struct{}

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

func New

func New() *RealFTL

New creates a new RealFTL

func (*RealFTL) FSMSend

func (r *RealFTL) FSMSend(ctx context.Context, fsm, instance string, event any) error

func (*RealFTL) PublishEvent added in v0.239.0

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

Jump to

Keyboard shortcuts

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