Documentation
¶
Overview ¶
Package wfinterp is an interpreter for the Google Cloud Workflows language: YAML or JSON workflow sources, ${...} expressions and the standard library. It performs no I/O of its own; time, HTTP, logging, callbacks and connectors come from a Host.
Index ¶
Constants ¶
const ( TagTypeError = "TypeError" TagValueError = "ValueError" TagKeyError = "KeyError" TagIndexError = "IndexError" TagZeroDivisionError = "ZeroDivisionError" TagArithmeticError = "ArithmeticError" TagHTTPError = "HttpError" TagConnectionError = "ConnectionError" TagConnectionFailed = "ConnectionFailedError" TagTimeoutError = "TimeoutError" TagRecursionError = "RecursionError" TagResourceLimitError = "ResourceLimitError" TagResponseTypeError = "ResponseTypeError" TagOperationError = "OperationError" TagUnhandledBranch = "UnhandledBranchError" TagRuntimeError = "RuntimeError" TagAuthError = "AuthError" TagSystemError = "SystemError" )
Error tags used by the runtime, as listed in the Workflows error reference.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// KnownConnector reports whether a googleapis.* name can be called; nil accepts every name.
KnownConnector func(name string) bool
// contains filtered or unexported fields
}
Engine holds the function library; it is safe for concurrent use.
func NewEngine ¶
func NewEngine() *Engine
NewEngine returns an Engine with the full standard library.
type Error ¶
Error is a workflow error: the value a raise produced or a runtime error map.
func NewError ¶
NewError builds a catchable error map with the given message and tags, for hosts such as connectors.
func NewHTTPError ¶
NewHTTPError builds the error a failed HTTP call raises.
func (*Error) Cancelled ¶
Cancelled reports whether the error is the execution being cancelled rather than a catchable error.
type Expr ¶
type Expr struct {
// contains filtered or unexported fields
}
Expr is a parsed ${...} expression.
type FuncRef ¶
type FuncRef struct{ Name string }
FuncRef is a reference to a named function or subworkflow, as produced by ${http.default_retry_predicate}.
type Host ¶
type Host struct {
Clock Clock
HTTP *http.Client
// Env resolves sys.get_env names.
Env func(name string) (string, bool)
// Log receives sys.log output.
Log func(LogEntry)
// Token returns a bearer token for http auth (kind is "OIDC" or "OAuth2").
Token func(kind, audience, scope, target string) string
// Connector runs a googleapis.* call; handled is false for an unknown connector.
Connector func(ctx context.Context, name string, args map[string]any) (result any, handled bool, err error)
// CreateCallback returns the URL callers POST to in order to resume events.await_callback.
CreateCallback func(ctx context.Context, method string) (url string, err error)
// AwaitCallback blocks until the callback at url is called or ctx ends.
AwaitCallback func(ctx context.Context, url string) (map[string]any, error)
// Progress is told which steps are executing each time they change.
Progress func([]Frame)
}
Host connects a running workflow to its surroundings. Every field is optional.
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program is a validated workflow.
type SyntaxError ¶
SyntaxError is a workflow that fails validation at deploy time.
func (*SyntaxError) Error ¶
func (e *SyntaxError) Error() string