Appearance
Methods and Package Functions
Steps, actions, workflows, and runs have methods for the common operations. The methods are the main API. The package functions stay supported and keep their behavior. This page maps each package function to its method.
Setup
| Package function | Method | Note |
|---|---|---|
cyclone.NewRegistry, Registry.Register, cyclone.NewClient | cyclone.New(pool, cyclone.WithHandlers(...)) | cyclone.New(pool) with no handlers gives a producer-only client. |
NewClient also accepts WithHandlers. It registers into the given registry, or into a new one if the registry is nil. WithHandlers and Registry.Register also accept a workflow. The worker then starts the child runs of that workflow.
Graph
| Package function | Method | Note |
|---|---|---|
cyclone.Do(b, step, in) | step.Do(b, in) | Returns the same *cyclone.Future[O]. |
cyclone.Run(b, action, in) | action.Do(b, in) | Returns the same *cyclone.Node. |
cyclone.From(f) | f | A *cyclone.Future[O] is an input of type O. The graph and the definition hash are the same. |
cyclone.Define with a future copied out of the closure | cyclone.DefineResult | The closure returns the future of the result node. The run stores that node. |
| None | step.ForEach(b, items), action.ForEach(b, items) | A fan-out node over the list of an upstream node. It has no package function. See Fan Out Over a List. |
| None | workflow.Child(b, in) | A child node starts a run of the workflow and gives its result. The result is a *cyclone.Future[Out] for a workflow from DefineResult. It is a *cyclone.Node for a workflow from Define. It has no package function. See Run a Child Workflow. |
Enqueue, Submit, and Schedule
The methods return a handle in place of a RunID. Use run.ID() to get the ID.
| Package function | Method | Result |
|---|---|---|
cyclone.Enqueue | step.Enqueue | *cyclone.ResultRun[O] |
cyclone.EnqueueTx | step.EnqueueTx | *cyclone.ResultRun[O] |
cyclone.EnqueueMany | step.EnqueueMany | []*cyclone.ResultRun[O] |
cyclone.EnqueueManyTx | step.EnqueueManyTx | []*cyclone.ResultRun[O] |
cyclone.EnqueueAction | action.Enqueue | *cyclone.RunHandle |
cyclone.EnqueueActionTx | action.EnqueueTx | *cyclone.RunHandle |
cyclone.EnqueueActionMany | action.EnqueueMany | []*cyclone.RunHandle |
cyclone.EnqueueActionManyTx | action.EnqueueManyTx | []*cyclone.RunHandle |
cyclone.Submit | workflow.Submit | *cyclone.RunHandle, or *cyclone.ResultRun[Out] for a workflow from DefineResult |
cyclone.SubmitTx | workflow.SubmitTx | *cyclone.RunHandle, or *cyclone.ResultRun[Out] for a workflow from DefineResult |
cyclone.Schedule | step.Schedule | Schedule ID |
cyclone.ScheduleTx | step.ScheduleTx | Schedule ID |
cyclone.ScheduleAction | action.Schedule | Schedule ID |
cyclone.ScheduleActionTx | action.ScheduleTx | Schedule ID |
cyclone.ScheduleWorkflow | workflow.Schedule | Schedule ID. A workflow schedule has no transactional form. A workflow from DefineResult has no schedule method. |
Batch handles have the order of the inputs. The methods use the same batch paths and savepoints as the functions.
Methods With No Package Function
New features are methods only. They have no package function form.
| Method | Result | Note |
|---|---|---|
workflow.SubmitOnce | *cyclone.RunHandle, bool, or *cyclone.ResultRun[Out], bool for a workflow from DefineResult | Inserts at most one run for each workflow name and key. The bool is true when the call inserted the run. See Submit a Workflow Once. |
workflow.SubmitOnceTx | *cyclone.RunHandle, bool, or *cyclone.ResultRun[Out], bool for a workflow from DefineResult | SubmitOnce in the caller transaction. |
Read and Control a Run
| Package function | Method |
|---|---|
client.GetRun(ctx, id) | run.Status(ctx) |
client.ListSteps(ctx, id) | run.Steps(ctx) |
cyclone.Wait(ctx, client, id) | run.Wait(ctx) |
client.Cancel(ctx, id) | run.Cancel(ctx) |
client.Signal(ctx, id, name, payload) | run.Signal(ctx, name, payload) |
client.Retry(ctx, id, node) | run.Retry(ctx, node) |
client.RetryAll(ctx, id) | run.RetryAll(ctx) |
cyclone.Wait, then cyclone.OutputNode with the step kind as the node ID, for a standalone step | run.Result(ctx) |
cyclone.OutputNode with the step kind as the node ID, for a standalone step | run.Output(ctx) |
cyclone.WaitOutput with a future copied out of the closure | run.Result(ctx), for a workflow from DefineResult |
cyclone.Output with a future copied out of the closure | run.Output(ctx), for a workflow from DefineResult |
cyclone.ValidateWorkflow(ctx, client, workflow, in) | workflow.Validate(ctx, client, in) |
run.Pause(ctx) and run.Resume(ctx) have no package function and no Client method. See Pause and Resume Runs.
To get a handle for a stored run ID, use client.OpenRun(id) for any run, or workflow.Open, step.Open, and action.Open. A handle from a definition checks the run identity before each operation. It returns cyclone.ErrRunMismatch for a run of a different workflow, kind, or kind version.
A handle from a DefineResult workflow reads the result node that the run stored. A run with no stored result node returns cyclone.ErrNoOutput. One example is a run from cyclone.Define with the same name.
Functions With No Method
These stay the API: cyclone.OutputNode, cyclone.Lit, cyclone.Join2 to cyclone.Join4, cyclone.FromAll, cyclone.After, cyclone.WaitSignal, cyclone.WaitN, cyclone.WaitAny, cyclone.WaitTimer, cyclone.EnqueueCompletion, cyclone.SubmitCompletion, and the registry API.
To read one node of a workflow run that is not the result, give the node an ID and use cyclone.OutputNode.