model

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package model is an implementation-independent vocabulary for specifying a sequence of events (a 'trace') in the lifetime of an activity. Drivers exist that can realize these events for both Standalone Activity and Workflow Activity.

Index

Constants

This section is empty.

Variables

View Source
var (
	Poll               = Event{Type: PollType}
	Heartbeat          = Event{Type: HeartbeatType}
	Complete           = Event{Type: RespondCompletedType}
	CompleteByID       = Event{Type: RespondCompletedByIDType}
	FailRetryably      = Event{Type: RespondFailedType, Failure: &Failure{Retryable: true}}
	FailNonRetryably   = Event{Type: RespondFailedType, Failure: &Failure{Retryable: false}}
	FailWithoutFailure = Event{Type: RespondFailedType}
	// FailByIDRetryablyWithServerFailure reports a retryable ServerFailure through the by-ID API. Unlike
	// the by-token API, the by-ID API accepts a non-application failure, so only this variant can carry a
	// ServerFailure to the handler.
	FailByIDRetryablyWithServerFailure              = Event{Type: RespondFailedByIDType, Failure: &Failure{Type: ServerFailureType, Retryable: true}}
	FailByIDRetryablyWithStartToCloseTimeoutFailure = Event{Type: RespondFailedByIDType, Failure: &Failure{Type: StartToCloseTimeoutFailureType}}
	FailByIDRetryablyWithHeartbeatTimeoutFailure    = Event{Type: RespondFailedByIDType, Failure: &Failure{Type: HeartbeatTimeoutFailureType}}
	FailByIDWithScheduleToStartTimeoutFailure       = Event{Type: RespondFailedByIDType, Failure: &Failure{Type: ScheduleToStartTimeoutFailureType}}
	FailByIDWithScheduleToCloseTimeoutFailure       = Event{Type: RespondFailedByIDType, Failure: &Failure{Type: ScheduleToCloseTimeoutFailureType}}
	FailByIDRetryablyWithUnknownFailure             = Event{Type: RespondFailedByIDType, Failure: &Failure{Type: UnknownFailureType}}
	RespondCanceled                                 = Event{Type: RespondCanceledType}
	RequestCancel                                   = Event{Type: RequestCancelType}
	Terminate                                       = Event{Type: TerminateType}
	Pause                                           = Event{Type: PauseType}
	ResetKeepPaused                                 = Event{Type: ResetType, KeepPaused: true}
	Unpause                                         = Event{Type: UnpauseType}
	Reset                                           = Event{Type: ResetType}
	ResetClearingHeartbeat                          = Event{Type: ResetType, ResetHeartbeat: true}
	UpdateOptions                                   = Event{Type: UpdateOptionsType}
	StartToCloseElapses                             = Event{Type: StartToCloseElapsesType}
	ScheduleToCloseElapses                          = Event{Type: ScheduleToCloseElapsesType}
	ScheduleToStartElapses                          = Event{Type: ScheduleToStartElapsesType}
	HeartbeatElapses                                = Event{Type: HeartbeatElapsesType}
	StartDelayElapses                               = Event{Type: StartDelayElapsesType}
	BackoffElapses                                  = Event{Type: BackoffElapsesType}
)

Canonical Event values for the variants frequently used in traces

Functions

This section is empty.

Types

type Event

type Event struct {
	Type EventType

	KeepPaused          bool     // Reset: a paused activity stays paused across the reset.
	ResetHeartbeat      bool     // Reset: discard the persisted heartbeat checkpoint instead of carrying it into the new attempt.
	HasHeartbeatDetails bool     // Failure response: attach last_heartbeat_details, to be stored as the activity's heartbeat progress.
	Failure             *Failure // RespondFailed: the failure to send, or nil to respond with no failure at all (as a worker may). A nil failure is retryable.
}

Event carries the variant flags that affect the outcome.

func (Event) String

func (e Event) String() string

String is a label for an event; it includes flags that affect its outcome.

type EventType

type EventType int

EventType enumerates the events a driver can realize.

const (
	// RPC events
	PollType EventType = iota
	HeartbeatType
	RespondCompletedType
	RespondCompletedByIDType
	RespondFailedType
	RespondFailedByIDType
	RespondCanceledType
	RequestCancelType
	TerminateType
	PauseType
	UnpauseType
	ResetType
	UpdateOptionsType

	// Timeout task timers elapsing (a timer may or may not have actually fired)
	ScheduleToStartElapsesType
	ScheduleToCloseElapsesType
	StartToCloseElapsesType
	HeartbeatElapsesType

	// Dispatch-delay timers elapsing. On elapse the delayed dispatch becomes available.
	StartDelayElapsesType
	BackoffElapsesType
)

func (EventType) String

func (t EventType) String() string

String is a label for an event type.

type Failure

type Failure struct {
	Type         FailureType
	Retryable    bool // controls the non-retryable flag for application and server failures.
	LargeMessage bool // sends a failure message exceeding activityFailureSizeLimit
}

Failure specifies the failure a RespondFailed event sends.

type FailureType

type FailureType int

FailureType identifies the kind of failure a RespondFailed event reports.

const (
	ApplicationFailureType FailureType = iota
	ServerFailureType
	StartToCloseTimeoutFailureType
	HeartbeatTimeoutFailureType
	ScheduleToStartTimeoutFailureType
	ScheduleToCloseTimeoutFailureType
	UnknownFailureType
)

Jump to

Keyboard shortcuts

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