flow

package
v17.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builtins added in v17.4.0

type Builtins interface {
	Print(msg string)
	Now() time.Time
}

type EventHandlerContext

type EventHandlerContext interface {
	HTTPDo(reqURL string, method string, query url.Values, header http.Header, body []byte) (*HTTPResponse, error)
	Select(cases *starlark.Dict, defaultCase starlark.Value, timeout startime.Duration, timeoutValue starlark.Value) (starlark.Value, error)
	Signal(workflowID string, signalName string, payloadJSON starlark.Value, runID string) (starlark.Value, error)
	SignalChannel(signalName string) ReceiveChannel
	Sleep(duration startime.Duration) (starlark.Value, error)
	Timer(duration startime.Duration) Future
}

TODO: eventually abstract starlark types away ... maybe?!

type Future

type Future interface {
	// TODO: support getting values out of it
	Get() error

	Unwrap() any
}

type FutureType

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

func (*FutureType) CallInternal

func (f *FutureType) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

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

type HTTPResponse added in v17.4.0

type HTTPResponse struct {
	Status     string
	StatusCode uint32
	Header     http.Header
	Body       []byte
}

type ModuleRef

type ModuleRef struct {
	// SourceName is the name of the source to use to fetch this module.
	// Empty string means the entrypoint project.
	SourceName string
	File       string
}

func (ModuleRef) String

func (r ModuleRef) String() string

type ModuleSource added in v17.4.0

type ModuleSource struct {
	SourceName string
	File       string
	Data       []byte
}

type PreloadedRuntimeOptions added in v17.4.0

type PreloadedRuntimeOptions struct {
	ProjectPath string
	Entrypoint  string
	Builtins    Builtins

	Modules []ModuleSource
}

type ReceiveChannel

type ReceiveChannel interface {
	// TODO: is this interface copied form temporal really the best one?
	Receive(payloadJSON *string) bool /* more */

	Unwrap() any
}

type ReceiveChannelType

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

func (*ReceiveChannelType) Attr

func (c *ReceiveChannelType) Attr(name string) (starlark.Value, error)

func (*ReceiveChannelType) AttrNames

func (c *ReceiveChannelType) AttrNames() []string

func (*ReceiveChannelType) Freeze

func (c *ReceiveChannelType) Freeze()

func (*ReceiveChannelType) Hash

func (c *ReceiveChannelType) Hash() (uint32, error)

func (*ReceiveChannelType) String

func (c *ReceiveChannelType) String() string

func (*ReceiveChannelType) Truth

func (c *ReceiveChannelType) Truth() starlark.Bool

func (*ReceiveChannelType) Type

func (c *ReceiveChannelType) Type() string

func (*ReceiveChannelType) Unwrap

func (c *ReceiveChannelType) Unwrap() any

type Runtime

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

func NewRuntimeFromPreloadedSource added in v17.4.0

func NewRuntimeFromPreloadedSource(ctx context.Context, opts PreloadedRuntimeOptions) (*Runtime, error)

func NewRuntimeFromSource

func NewRuntimeFromSource(ctx context.Context, opts RuntimeOptions) (*Runtime, error)

func (*Runtime) EvaluateEventHandlerIds

func (r *Runtime) EvaluateEventHandlerIds(typ string, event *starlark.Dict) ([]string, error)

func (*Runtime) Execute

func (r *Runtime) Execute(eventType string, eventHandlerID uint32, ctx EventHandlerContext, vars starlark.StringDict, event *starlark.Dict) error

func (*Runtime) LoadedModules added in v17.4.0

func (r *Runtime) LoadedModules() []ModuleSource

type RuntimeOptions

type RuntimeOptions struct {
	ProjectPath string
	Entrypoint  string
	Builtins    Builtins

	Source Source
}

type Source

type Source interface {
	// SetupThreadLocal configures thread local variables for this source.
	// projectPath is GitLab project path of the entrypoint project.
	SetupThreadLocal(thread *starlark.Thread, projectPath string)
	// RecordSource
	// fullGitRef is the full git reference:
	// - refs/heads/<name> for branches
	// - refs/tags/<name> for tags
	// - <commit id> for commits
	// - empty string or HEAD to use the default branch.
	RecordSource(thread *starlark.Thread, name, projectPath, fullGitRef string) error
	LoadFile(ctx context.Context, thread *starlark.Thread, ref ModuleRef) ([]byte, error)
}

type TestingSource added in v17.4.0

type TestingSource = preloadedSource

func NewTestingSource added in v17.4.0

func NewTestingSource(modules []ModuleSource) *TestingSource

Jump to

Keyboard shortcuts

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