Skip to content

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 functionMethodNote
cyclone.NewRegistry, Registry.Register, cyclone.NewClientcyclone.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 functionMethodNote
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)fA *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 closurecyclone.DefineResultThe closure returns the future of the result node. The run stores that node.
Nonestep.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.
Noneworkflow.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 functionMethodResult
cyclone.Enqueuestep.Enqueue*cyclone.ResultRun[O]
cyclone.EnqueueTxstep.EnqueueTx*cyclone.ResultRun[O]
cyclone.EnqueueManystep.EnqueueMany[]*cyclone.ResultRun[O]
cyclone.EnqueueManyTxstep.EnqueueManyTx[]*cyclone.ResultRun[O]
cyclone.EnqueueActionaction.Enqueue*cyclone.RunHandle
cyclone.EnqueueActionTxaction.EnqueueTx*cyclone.RunHandle
cyclone.EnqueueActionManyaction.EnqueueMany[]*cyclone.RunHandle
cyclone.EnqueueActionManyTxaction.EnqueueManyTx[]*cyclone.RunHandle
cyclone.Submitworkflow.Submit*cyclone.RunHandle, or *cyclone.ResultRun[Out] for a workflow from DefineResult
cyclone.SubmitTxworkflow.SubmitTx*cyclone.RunHandle, or *cyclone.ResultRun[Out] for a workflow from DefineResult
cyclone.Schedulestep.ScheduleSchedule ID
cyclone.ScheduleTxstep.ScheduleTxSchedule ID
cyclone.ScheduleActionaction.ScheduleSchedule ID
cyclone.ScheduleActionTxaction.ScheduleTxSchedule ID
cyclone.ScheduleWorkflowworkflow.ScheduleSchedule 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.

MethodResultNote
workflow.SubmitOnce*cyclone.RunHandle, bool, or *cyclone.ResultRun[Out], bool for a workflow from DefineResultInserts 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 DefineResultSubmitOnce in the caller transaction.

Read and Control a Run ​

Package functionMethod
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 steprun.Result(ctx)
cyclone.OutputNode with the step kind as the node ID, for a standalone steprun.Output(ctx)
cyclone.WaitOutput with a future copied out of the closurerun.Result(ctx), for a workflow from DefineResult
cyclone.Output with a future copied out of the closurerun.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.

Cyclone stores each run in Postgres.