autoflow

package
v19.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextFromThread

func ContextFromThread(thread *starlark.Thread) context.Context

func ExecScript

func ExecScript(ctx context.Context, opts ExecScriptOptions) (starlark.Value, error)

ExecScript runs a Starlark script that must define a top-level `main(w)` function, then calls `main` passing a `w` module and returns the value produced by `main` (which is `starlark.None` when `main` has no explicit return).

Types

type Backend

type Backend interface {
	Print(msg string)
	Now() time.Time
	Load(ctx context.Context, thread *starlark.Thread, module string) (starlark.StringDict, error)
	Select(ctx context.Context, cases *starlark.Dict, defaultCase starlark.Value, timeout time.Duration, timeoutValue starlark.Value) (starlark.Value, error)
	Signal(ctx context.Context, workflowID, signalName, payloadJSON, runID string) (bool, error)
	ReceiveChannel(channelName string) (Future, error)
	Sleep(ctx context.Context, duration time.Duration) error
	Timer(duration time.Duration) Future
	WorkflowID() string
	// Gather waits for all given futures. If returnList is false it returns the
	// single future's value; otherwise it returns a starlark.List of values.
	// If timeout is non-zero and elapses before all futures are ready, it returns
	// timeoutValue instead of a result.
	Gather(ctx context.Context, futures []Future, timeout time.Duration, timeoutValue starlark.Value, returnList bool) (starlark.Value, error)
	// Run schedules a built-in activity identified by uri and returns a Future
	// whose Get() yields the activity's decoded output value. args are the
	// remaining positional arguments in stringified form; their meaning is
	// uri-specific and opaque to the engine.
	Run(uri string, args []string) (Future, error)
}

Backend is the interface of AutoFlow backend implementation.

type ExecScriptOptions

type ExecScriptOptions struct {
	Definition []byte
	Backend    Backend
	Tracer     trace.Tracer
	// ExtraWMembers are merged into the `w` Starlark module that is passed to `main(w).
	ExtraWMembers starlark.StringDict
}

type Future

type Future interface {
	Get() (starlark.Value, error)
	Unwrap() any
}

type FutureType

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

func NewFutureType

func NewFutureType(f Future) *FutureType

NewFutureType wraps a Future as a starlark Value.

func (*FutureType) Freeze

func (f *FutureType) Freeze()

func (*FutureType) Hash

func (f *FutureType) Hash() (uint32, error)

func (*FutureType) Name

func (f *FutureType) Name() string

func (*FutureType) String

func (f *FutureType) String() string

func (*FutureType) Truth

func (f *FutureType) Truth() starlark.Bool

func (*FutureType) Type

func (f *FutureType) Type() string

func (*FutureType) Unwrap

func (f *FutureType) Unwrap() any

Jump to

Keyboard shortcuts

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