history

package
v0.18.5 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeserializeAttributes

func DeserializeAttributes(eventType EventType, attributes []byte) (attr interface{}, err error)

func EventsByWorkflowInstance

func EventsByWorkflowInstance(events []WorkflowEvent) map[core.WorkflowInstance][]WorkflowEvent

func SerializeAttributes

func SerializeAttributes(attributes interface{}) ([]byte, error)

Types

type ActivityCompletedAttributes

type ActivityCompletedAttributes struct {
	Result payload.Payload `json:"result,omitempty"`
}

type ActivityFailedAttributes

type ActivityFailedAttributes struct {
	Error *workflowerrors.Error `json:"error,omitempty"`
}

type ActivityScheduledAttributes

type ActivityScheduledAttributes struct {
	Name string `json:"name,omitempty"`

	Inputs []payload.Payload `json:"inputs,omitempty"`

	Metadata *metadata.WorkflowMetadata `json:"metadata,omitempty"`
}

type Event

type Event struct {
	// ID is a unique identifier for this event
	ID string `json:"id,omitempty"`

	// SequenceID is a monotonically increasing sequence number this event. It's only set for events that have
	// been executed and are in the history
	SequenceID int64 `json:"sid,omitempty"`

	Type EventType `json:"t,omitempty"`

	Timestamp time.Time `json:"ts,omitempty"`

	// ScheduleEventID is used to correlate events belonging together
	// For example, if an activity is scheduled, ScheduleEventID of the schedule event and the
	// completion/failure event are the same.
	ScheduleEventID int64 `json:"seid,omitempty"`

	// Attributes are event type specific attributes
	Attributes interface{} `json:"attr,omitempty"`

	VisibleAt *time.Time `json:"vat,omitempty"`
}

func NewHistoryEvent

func NewHistoryEvent(sequenceID int64, timestamp time.Time, eventType EventType, attributes interface{}, opts ...HistoryEventOption) *Event

func NewPendingEvent

func NewPendingEvent(timestamp time.Time, eventType EventType, attributes interface{}, opts ...HistoryEventOption) *Event

func NewWorkflowCancellationEvent

func NewWorkflowCancellationEvent(timestamp time.Time) *Event

func (Event) String

func (e Event) String() string

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(data []byte) error

type EventType

type EventType uint
const (

	// Workflow has started
	EventType_WorkflowExecutionStarted EventType
	// Workflow has finished
	EventType_WorkflowExecutionFinished
	// Workflow has continued as new
	EventType_WorkflowExecutionContinuedAsNew
	// Workflow has been terminated (not yet used)
	EventType_WorkflowExecutionTerminated
	// Workflow has been canceled
	EventType_WorkflowExecutionCanceled

	// Workflow task has been started. This event is added to the history every time a workflow task is
	// picked up by the worker.
	EventType_WorkflowTaskStarted

	// SubWorkflow has been scheduled
	EventType_SubWorkflowScheduled
	// SubWorkflow cancellation has been requested
	EventType_SubWorkflowCancellationRequested
	// SubWorkflow has completed
	EventType_SubWorkflowCompleted
	// SubWorkflow has failed
	EventType_SubWorkflowFailed

	// Activity task has been scheduled
	EventType_ActivityScheduled
	// Activity task has been completed
	EventType_ActivityCompleted
	// Activity task has failed
	EventType_ActivityFailed

	// Timer has been scheduled
	EventType_TimerScheduled
	// Timer has fired. This is the event received by a workflow when a previously scheduled timer fires.
	EventType_TimerFired
	// Timer has been canceled.
	EventType_TimerCanceled

	// Workflow has received a signal
	EventType_SignalReceived

	// Recorded result of a side-efect
	EventType_SideEffectResult
)

func (EventType) String

func (et EventType) String() string

type ExecutionCanceledAttributes

type ExecutionCanceledAttributes struct {
}

type ExecutionCompletedAttributes

type ExecutionCompletedAttributes struct {
	Result payload.Payload       `json:"result,omitempty"`
	Error  *workflowerrors.Error `json:"error,omitempty"`
}

type ExecutionContinuedAsNewAttributes

type ExecutionContinuedAsNewAttributes struct {
	Result payload.Payload `json:"result,omitempty"`

	ContinuedExecutionID string `json:"continued_execution_id,omitempty"`
}

type ExecutionStartedAttributes

type ExecutionStartedAttributes struct {
	Name string `json:"name,omitempty"`

	Metadata *metadata.WorkflowMetadata `json:"metadata,omitempty"`

	Inputs []payload.Payload `json:"inputs,omitempty"`
}

type HistoryEventOption

type HistoryEventOption func(e *Event)

func ScheduleEventID

func ScheduleEventID(scheduleEventID int64) HistoryEventOption

func VisibleAt

func VisibleAt(visibleAt time.Time) HistoryEventOption

type SideEffectResultAttributes

type SideEffectResultAttributes struct {
	Result payload.Payload `json:"result,omitempty"`
}

type SignalReceivedAttributes

type SignalReceivedAttributes struct {
	Name string          `json:"name,omitempty"`
	Arg  payload.Payload `json:"arg,omitempty"`
}

type SubWorkflowCancellationRequestedAttributes

type SubWorkflowCancellationRequestedAttributes struct {
	SubWorkflowInstance *core.WorkflowInstance `json:"sub_workflow_instance,omitempty"`
}

type SubWorkflowCompletedAttributes

type SubWorkflowCompletedAttributes struct {
	Result payload.Payload `json:"result,omitempty"`
}

type SubWorkflowFailedAttributes

type SubWorkflowFailedAttributes struct {
	Error *workflowerrors.Error `json:"error,omitempty"`
}

type SubWorkflowScheduledAttributes

type SubWorkflowScheduledAttributes struct {
	SubWorkflowInstance *core.WorkflowInstance `json:"sub_workflow_instance,omitempty"`

	Name string `json:"name,omitempty"`

	Inputs []payload.Payload `json:"inputs,omitempty"`

	Metadata *metadata.WorkflowMetadata `json:"metadata,omitempty"`
}

type TimerCanceledAttributes

type TimerCanceledAttributes struct{}

type TimerFiredAttributes

type TimerFiredAttributes struct {
	At time.Time `json:"at,omitempty"`
}

type TimerScheduledAttributes

type TimerScheduledAttributes struct {
	At time.Time `json:"at,omitempty"`
}

type WorkflowEvent

type WorkflowEvent struct {
	WorkflowInstance *core.WorkflowInstance `json:"workflow_instance,omitempty"`

	HistoryEvent *Event `json:"history_event,omitempty"`
}

WorkflowEvent is a event addressed for a specific workflow instance

type WorkflowTaskStartedAttributes

type WorkflowTaskStartedAttributes struct {
}

Jump to

Keyboard shortcuts

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