callback

package
v0.19.997 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// QuickTimeout is for fast infrastructure operations: validation, no-op
	// signals, DB-row creation. If these take longer than 5 minutes something
	// is stuck.
	QuickTimeout = 5 * time.Minute

	// DriftDetectionTimeout is for drift-detection signals which are lightweight
	// but fan out through the webhook/Slack pipeline.
	DriftDetectionTimeout = 15 * time.Minute

	// ShortTimeout is for operations expected to complete within minutes:
	// state generation, lightweight queue signals.
	ShortTimeout = 30 * time.Minute

	// HumanGatedTimeout is for operations that require human interaction:
	// approval workflows, user-initiated stack runs.
	HumanGatedTimeout = 180 * 24 * time.Hour

	// FallbackAwaitTimeout caps a wait that has no configured timeout.
	FallbackAwaitTimeout = 30 * 24 * time.Hour
)

Variables

This section is empty.

Functions

func Send

func Send(ctx workflow.Context, l *zap.Logger, ref Ref, result Result)

Send signals the target workflow described by ref with the given result. Best-effort: if the target workflow has already terminated, the error is logged but not propagated.

func SignalName

func SignalName(id string) string

SignalName returns the deterministic signal name for a given id.

Types

type Ref

type Ref struct {
	WorkflowID string `json:"workflow_id,omitempty"`
	SignalName string `json:"signal_name,omitempty"`
	Namespace  string `json:"namespace,omitempty"`
}

Ref describes where to send a Temporal signal when an operation completes. It is stored as a JSONB column on QueueSignal and passed through the enqueue → handler → completion chain.

func New

func New(ctx workflow.Context, id string) Ref

New creates a Ref pointing back to the current workflow with a deterministic signal name derived from id. The caller should register the signal channel before the handler starts to avoid races.

func NewAttempt added in v0.19.991

func NewAttempt(ctx workflow.Context, id string, attempt int) Ref

NewAttempt scopes the signal name per dispatch to avoid stale completions.

func (Ref) GormDataType

func (Ref) GormDataType() string

GormDataType tells GORM to use the jsonb PostgreSQL type.

func (Ref) IsSet

func (c Ref) IsSet() bool

IsSet returns true if the callback has a target workflow.

func (*Ref) Scan

func (c *Ref) Scan(v interface{}) error

Scan implements database/sql.Scanner for reading JSONB from PostgreSQL.

func (Ref) Value

func (c Ref) Value() (driver.Value, error)

Value implements driver.Valuer for writing JSONB to PostgreSQL.

type Refs added in v0.19.978

type Refs []Ref

Refs is a slice of Ref with JSONB serialization for GORM. It replaces the single Callback field on QueueSignal to support multiple completion callbacks (e.g. from EnsureSignal).

func (*Refs) Add added in v0.19.978

func (r *Refs) Add(ref Ref)

Add appends a callback ref if it is set.

func (Refs) GormDataType added in v0.19.978

func (Refs) GormDataType() string

GormDataType tells GORM to use the jsonb PostgreSQL type.

func (Refs) IsSet added in v0.19.978

func (r Refs) IsSet() bool

IsSet returns true if there is at least one callback target.

func (*Refs) Scan added in v0.19.978

func (r *Refs) Scan(v interface{}) error

Scan implements database/sql.Scanner for reading JSONB from PostgreSQL.

func (Refs) Value added in v0.19.978

func (r Refs) Value() (driver.Value, error)

Value implements driver.Valuer for writing JSONB to PostgreSQL.

type Result

type Result struct {
	Status            string `json:"status"`
	StatusDescription string `json:"status_description,omitempty"`
}

Result is the payload sent by the handler on completion.

func AwaitWithTimeout added in v0.19.991

func AwaitWithTimeout(ctx workflow.Context, ref Ref, timeout time.Duration) (*Result, error)

AwaitWithTimeout waits for a completion signal on the Ref's signal channel. A timeout <= 0 waits with no wall-clock deadline (for human-gated waits).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL