Documentation
¶
Overview ¶
Package migrationguides holds the Go code rendered into the migration guides. Each snippet here is the source of truth for a code block in the docs; edit the code, not the .mdx.
Index ¶
- func CreateReportSchedules(client *hatchet.Client) error
- func ImageProcessor(client *hatchet.Client) *hatchet.StandaloneTask
- func NewApprovalFlow(client *hatchet.Client) *hatchet.StandaloneTask
- func NewChargeOrder(client *hatchet.Client) *hatchet.StandaloneTask
- func NewChargeOrderWithRetries(client *hatchet.Client) *hatchet.StandaloneTask
- func NewDailyDigest(client *hatchet.Client) *hatchet.StandaloneTask
- func NewFlowControlledTasks(client *hatchet.Client) (syncCustomer, callModel *hatchet.StandaloneTask)
- func NewFulfillOrder(client *hatchet.Client) *hatchet.StandaloneTask
- func NewLoggedChargeOrder(client *hatchet.Client) *hatchet.StandaloneTask
- func NewOnboardingFlow(client *hatchet.Client, ...) *hatchet.StandaloneTask
- func NewOrderWorkflow(client *hatchet.Client) *hatchet.Workflow
- func NewProcessItem(client *hatchet.Client) *hatchet.StandaloneTask
- func NewProcessOrder(client *hatchet.Client, ...) *hatchet.StandaloneTask
- func NewSendFollowupEmail(client *hatchet.Client) *hatchet.StandaloneTask
- func NewSendWelcomeEmail(client *hatchet.Client) *hatchet.StandaloneTask
- func NewShipOrderItems(client *hatchet.Client, processItem *hatchet.StandaloneTask) *hatchet.StandaloneTask
- func NewValidateOrder(client *hatchet.Client) *hatchet.StandaloneTask
- func NewWeeklyReport(client *hatchet.Client) *hatchet.StandaloneTask
- func ProcessImage(imageURL string, filters []string) (map[string]interface{}, error)
- func PushApprovalGranted(client *hatchet.Client, correlationID string) error
- func RunMergentTask() error
- func RunOrderWorker() error
- func RunningTasks(client *hatchet.Client) error
- type ApprovalEvent
- type ApprovalOutput
- type ChargeOutput
- type FulfillOutput
- type ImageProcessInput
- type ImageProcessOutput
- type Item
- type ItemInput
- type ItemOutput
- type MergentRequest
- type MergentResponse
- type ModelOutput
- type OnboardingInput
- type OnboardingOutput
- type OrderInput
- type PromptInput
- type ReportInput
- type ReportOutput
- type ShipmentInput
- type ShipmentOutput
- type SyncInput
- type SyncOutput
- type ValidateOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateReportSchedules ¶ added in v0.104.5
CreateReportSchedules creates the two runtime schedule kinds through the API, the replacement for Temporal's programmatic schedule client.
func ImageProcessor ¶
func ImageProcessor(client *hatchet.Client) *hatchet.StandaloneTask
func NewApprovalFlow ¶ added in v0.104.5
func NewApprovalFlow(client *hatchet.Client) *hatchet.StandaloneTask
NewApprovalFlow declares the waiting side of a Temporal signal: a durable task that blocks on an event matching this run's correlation id.
func NewChargeOrder ¶ added in v0.104.5
func NewChargeOrder(client *hatchet.Client) *hatchet.StandaloneTask
NewChargeOrder declares the charge-order task: ordinary code, retried by the engine, and runnable on its own without a workflow to orchestrate it.
func NewChargeOrderWithRetries ¶ added in v0.104.5
func NewChargeOrderWithRetries(client *hatchet.Client) *hatchet.StandaloneTask
NewChargeOrderWithRetries declares a charge-order variant carrying the settings that a Temporal RetryPolicy and activity options used to carry at the call site.
func NewDailyDigest ¶ added in v0.104.5
func NewDailyDigest(client *hatchet.Client) *hatchet.StandaloneTask
NewDailyDigest declares the durable task whose body is dailyDigest.
func NewFlowControlledTasks ¶ added in v0.104.5
func NewFlowControlledTasks(client *hatchet.Client) (syncCustomer, callModel *hatchet.StandaloneTask)
NewFlowControlledTasks declares the two engine-level flow controls that replace partitioned task queues and an external rate limiter in front of an activity. The "openai" key has to exist first: see client.RateLimits().Upsert.
func NewFulfillOrder ¶ added in v0.104.5
func NewFulfillOrder(client *hatchet.Client) *hatchet.StandaloneTask
NewFulfillOrder declares the fulfill-order task.
func NewLoggedChargeOrder ¶ added in v0.104.5
func NewLoggedChargeOrder(client *hatchet.Client) *hatchet.StandaloneTask
NewLoggedChargeOrder declares a charge-order task that writes to the run's built-in log sink, which replaces the logging wiring around a Temporal activity.
func NewOnboardingFlow ¶ added in v0.104.5
func NewOnboardingFlow(client *hatchet.Client, sendWelcomeEmail, sendFollowupEmail *hatchet.StandaloneTask) *hatchet.StandaloneTask
NewOnboardingFlow declares a durable task that waits between two emails. A run is evicted while it sleeps, so its worker slot is released for the three days.
func NewOrderWorkflow ¶ added in v0.104.5
NewOrderWorkflow declares the same order flow as a DAG. It replaces the ProcessOrder durable task once the migration is green: the orchestration code is gone, and upstream results are read off the context rather than passed through local variables. It registers under its own name so that it and the durable task it replaces can both be served while the cutover is in progress.
func NewProcessItem ¶ added in v0.104.5
func NewProcessItem(client *hatchet.Client) *hatchet.StandaloneTask
NewProcessItem declares the child task spawned once per line item.
func NewProcessOrder ¶ added in v0.104.5
func NewProcessOrder(client *hatchet.Client, validateOrder, chargeOrder, fulfillOrder *hatchet.StandaloneTask) *hatchet.StandaloneTask
NewProcessOrder declares the 1:1 translation of a Temporal workflow: a durable task whose body calls the three order tasks in the order the workflow called its activities.
func NewSendFollowupEmail ¶ added in v0.104.5
func NewSendFollowupEmail(client *hatchet.Client) *hatchet.StandaloneTask
NewSendFollowupEmail declares the task that sends the follow-up email.
func NewSendWelcomeEmail ¶ added in v0.104.5
func NewSendWelcomeEmail(client *hatchet.Client) *hatchet.StandaloneTask
NewSendWelcomeEmail declares the task that sends the welcome email.
func NewShipOrderItems ¶ added in v0.104.5
func NewShipOrderItems(client *hatchet.Client, processItem *hatchet.StandaloneTask) *hatchet.StandaloneTask
NewShipOrderItems declares a durable task that spawns one child run per line item. Spawning from a durable task checkpoints each child, so a crash mid-fan-out resumes without re-running the children that already finished.
func NewValidateOrder ¶ added in v0.104.5
func NewValidateOrder(client *hatchet.Client) *hatchet.StandaloneTask
NewValidateOrder declares the validate-order task.
func NewWeeklyReport ¶ added in v0.104.5
func NewWeeklyReport(client *hatchet.Client) *hatchet.StandaloneTask
NewWeeklyReport declares a task Hatchet triggers on a cron schedule. Go and Python are the two SDKs that can attach a fixed input to a declared cron.
func ProcessImage ¶
ProcessImage simulates image processing
func PushApprovalGranted ¶ added in v0.104.5
PushApprovalGranted pushes the event that releases a waiting ApprovalFlow run. Unlike a Temporal signal this is not addressed to a run, so the payload carries the correlation id that the waiting run filters on.
func RunMergentTask ¶
func RunMergentTask() error
func RunOrderWorker ¶ added in v0.104.5
func RunOrderWorker() error
RunOrderWorker starts a worker serving the order tasks and the durable task that orchestrates them. This is the Hatchet replacement for a Temporal client plus a Worker bound to a task queue.
func RunningTasks ¶
Types ¶
type ApprovalEvent ¶ added in v0.104.5
type ApprovalEvent struct {
CorrelationID string `json:"correlation_id"`
ApprovedBy string `json:"approved_by"`
}
ApprovalEvent is the payload carried by an approval:granted event.
type ApprovalOutput ¶ added in v0.104.5
type ApprovalOutput struct {
Approved bool `json:"approved"`
ApprovedBy string `json:"approved_by"`
}
ApprovalOutput is returned by the durable task that waits for an approval.
type ChargeOutput ¶ added in v0.104.5
ChargeOutput is returned by the charge-order task.
type FulfillOutput ¶ added in v0.104.5
type FulfillOutput struct {
Fulfilled bool `json:"fulfilled"`
TrackingID string `json:"tracking_id"`
AmountCents int64 `json:"amount_cents"`
}
FulfillOutput is returned by the fulfill-order task and by the ProcessOrder flow.
func TriggerProcessOrder ¶ added in v0.104.5
func TriggerProcessOrder(processOrder *hatchet.StandaloneTask) (FulfillOutput, error)
TriggerProcessOrder enqueues an order without waiting for it, then collects the result. This is the Hatchet replacement for start_workflow plus handle.result().
type ImageProcessInput ¶
type ImageProcessInput struct {
ImageURL string `json:"image_url"`
Filters []string `json:"filters"`
}
> After (Hatchet)
type ImageProcessOutput ¶
type ItemInput ¶ added in v0.104.5
type ItemInput struct {
Item Item `json:"item"`
}
ItemInput is the input to the per-item child task.
type ItemOutput ¶ added in v0.104.5
ItemOutput is returned by the per-item child task.
type MergentRequest ¶
> Before (Mergent)
type MergentResponse ¶
type MergentResponse struct {
Success bool `json:"success"`
ProcessedURL string `json:"processed_url"`
}
func ProcessImageMergent ¶
func ProcessImageMergent(req MergentRequest) (*MergentResponse, error)
type ModelOutput ¶ added in v0.104.5
type ModelOutput struct {
Completion string `json:"completion"`
}
ModelOutput is the completion returned by the model call.
type OnboardingInput ¶ added in v0.104.5
OnboardingInput is the input to the onboarding durable task.
type OnboardingOutput ¶ added in v0.104.5
type OnboardingOutput struct {
EmailsSent int `json:"emails_sent"`
}
OnboardingOutput reports how many emails the onboarding flow sent.
type OrderInput ¶ added in v0.104.5
type OrderInput struct {
OrderID string `json:"order_id"`
CorrelationID string `json:"correlation_id"`
}
OrderInput is the structured input every task in the order flow receives. Temporal activities take positional arguments; Hatchet tasks take one value.
type PromptInput ¶ added in v0.104.5
type PromptInput struct {
Prompt string `json:"prompt"`
}
PromptInput is the input to the rate-limited model call.
type ReportInput ¶ added in v0.104.5
type ReportInput struct {
Kind string `json:"kind"`
}
ReportInput selects which report to generate.
type ReportOutput ¶ added in v0.104.5
type ReportOutput struct {
Rows int `json:"rows"`
}
ReportOutput reports how many rows the report contained.
type ShipmentInput ¶ added in v0.104.5
ShipmentInput is the input to the task that fans out over line items.
type ShipmentOutput ¶ added in v0.104.5
type ShipmentOutput struct {
Shipped int `json:"shipped"`
}
ShipmentOutput reports how many line items shipped.
type SyncInput ¶ added in v0.104.5
type SyncInput struct {
CustomerID string `json:"customer_id"`
}
SyncInput identifies the customer whose records are being synced.
type SyncOutput ¶ added in v0.104.5
type SyncOutput struct {
Records int `json:"records"`
}
SyncOutput reports how many records were synced.
type ValidateOutput ¶ added in v0.104.5
type ValidateOutput struct {
Valid bool `json:"valid"`
}
ValidateOutput is returned by the validate-order task.