Documentation ¶
Overview ¶
Package reg implements a temporal.io workflow singleton worker and query functions to keep a global registry of all available fse workflow types
Index ¶
Constants ¶
const ( // QueryWorkflowWorkflowsAdmin lists all known workflows of all versions (admin mode). It has no parameters. QueryWorkflowWorkflowsAdmin = "workflows" // QueryWorkflowWorkflowsFor lists all newest versions of workflows for the given option and roles. It has two parameters: string and []string. QueryWorkflowWorkflowsFor = "workflows-for" // QueryWorkflowGetWorkflow lists zero or all workflows of the given Common ordered by Version descending. It has one parameter: Common. QueryWorkflowGetWorkflow = "get-workflow" // SignalWorkflowRegister is the signal's name to be passed to SignalWorkflow to register a new fse workflow type SignalWorkflowRegister = "register" )
const ( // TaskQueue is temporal's task queue name for hosting this Registry workflow TaskQueue = "_FSERegistry" // WorkflowID is this Registry workflow's ID as a singleton WorkflowID = "_FSEGlobal" )
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register queries for a Type type, if it doesn't exist or is different, replace it. This function also starts the Registry workflow if there is no instance of it.
Types ¶
type Common ¶
type Common struct {
WorkflowName syntax.Unversioned `json:"workflowName,omitempty"`
}
Common is the combined key for an FSE workflow description. All other fields of Start are dependent of this properties in terms of beeing registered with the Registry temporal workflow. In v1 this is the Workflow name only.
type Dependent ¶
type Dependent struct { Version syntax.Unversioned `json:"version,omitempty"` Option string `json:"option,omitempty"` Display string `json:"display,omitempty"` Description string `json:"description,omitempty"` TaskQueue string `json:"taskQueue,omitempty"` }
Dependent are automatically comparable attributes of an FSE workflow description. Workflows have an optional Version string. Any non empty Version is always newer than the empty Version and a lexicographically larger string is considered to be a newer version.
func (Dependent) OptionParsed ¶
OptionParsed returns Option parsed as option.Option or empty options if invalid
type Statename ¶ added in v0.5.6
type Statename struct { Name string `json:"name,omitempty"` Display string `json:"display,omitempty"` }
Statename describes a workflow state by key and display text
type Type ¶
type Type struct { Common Dependent Roles []string `json:"roles,omitempty"` Statenames []Statename `json:"statenames,omitempty"` }
Type describes an FSE workflow
func Versions ¶
func Versions(ctx context.Context, cli client.Client, workflowName syntax.Unversioned) ([]Type, error)
Versions returns all Versions sorted newer to older of a particular workflow type
func WorkflowsOf ¶
func WorkflowsOf(ctx context.Context, cli client.Client, option string, roles []string) ([]Type, error)
WorkflowsOf returns all currently registered workflows filtered by option and a list of roles
func (Type) Equals ¶
Equals is true, if all attributes match and the Roles slices are index-wise equal
func (Type) IntersectsWith ¶
IntersectsWith is true if e.Roles is empty or otherwise if there is a non-empty intersection between e.Roles and the given roles