mutablestate

package
v1.10.5 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HistoryBuilderStateMutable   HistoryBuilderState = 0
	HistoryBuilderStateImmutable                     = 1
	HistoryBuilderStateSealed                        = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HistoryBuilder

type HistoryBuilder struct {
	// contains filtered or unexported fields
}

TODO should the reorderFunc functionality be ported?

func NewImmutableHistoryBuilder

func NewImmutableHistoryBuilder(
	history []*historypb.HistoryEvent,
) *HistoryBuilder

func NewMutableHistoryBuilder

func NewMutableHistoryBuilder(
	timeSource clock.TimeSource,
	taskIDGenerator TaskIDGenerator,
	version int64,
	nextEventID int64,
	dbBufferBatch []*historypb.HistoryEvent,
) *HistoryBuilder

func (*HistoryBuilder) AddActivityTaskCancelRequestedEvent

func (b *HistoryBuilder) AddActivityTaskCancelRequestedEvent(
	workflowTaskCompletedEventID int64,
	scheduleID int64,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddActivityTaskCanceledEvent

func (b *HistoryBuilder) AddActivityTaskCanceledEvent(
	scheduleEventID int64,
	startedEventID int64,
	latestCancelRequestedEventID int64,
	details *commonpb.Payloads,
	identity string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddActivityTaskCompletedEvent

func (b *HistoryBuilder) AddActivityTaskCompletedEvent(
	scheduleEventID int64,
	startedEventID int64,
	identity string,
	result *commonpb.Payloads,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddActivityTaskFailedEvent

func (b *HistoryBuilder) AddActivityTaskFailedEvent(
	scheduleEventID int64,
	startedEventID int64,
	failure *failurepb.Failure,
	retryState enumspb.RetryState,
	identity string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddActivityTaskScheduledEvent

func (b *HistoryBuilder) AddActivityTaskScheduledEvent(
	workflowTaskCompletedEventID int64,
	command *commandpb.ScheduleActivityTaskCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddActivityTaskStartedEvent

func (b *HistoryBuilder) AddActivityTaskStartedEvent(
	scheduleEventID int64,
	attempt int32,
	requestID string,
	identity string,
	lastFailure *failurepb.Failure,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddActivityTaskTimedOutEvent

func (b *HistoryBuilder) AddActivityTaskTimedOutEvent(
	scheduleEventID,
	startedEventID int64,
	timeoutFailure *failurepb.Failure,
	retryState enumspb.RetryState,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddChildWorkflowExecutionCanceledEvent

func (b *HistoryBuilder) AddChildWorkflowExecutionCanceledEvent(
	initiatedID int64,
	startedID int64,
	namespace string,
	execution *commonpb.WorkflowExecution,
	workflowType *commonpb.WorkflowType,
	details *commonpb.Payloads,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddChildWorkflowExecutionCompletedEvent

func (b *HistoryBuilder) AddChildWorkflowExecutionCompletedEvent(
	initiatedID int64,
	startedID int64,
	namespace string,
	execution *commonpb.WorkflowExecution,
	workflowType *commonpb.WorkflowType,
	result *commonpb.Payloads,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddChildWorkflowExecutionFailedEvent

func (b *HistoryBuilder) AddChildWorkflowExecutionFailedEvent(
	initiatedID int64,
	startedID int64,
	namespace string,
	execution *commonpb.WorkflowExecution,
	workflowType *commonpb.WorkflowType,
	failure *failurepb.Failure,
	retryState enumspb.RetryState,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddChildWorkflowExecutionStartedEvent

func (b *HistoryBuilder) AddChildWorkflowExecutionStartedEvent(
	initiatedID int64,
	namespace string,
	execution *commonpb.WorkflowExecution,
	workflowType *commonpb.WorkflowType,
	header *commonpb.Header,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddChildWorkflowExecutionTerminatedEvent

func (b *HistoryBuilder) AddChildWorkflowExecutionTerminatedEvent(
	initiatedID int64,
	startedID int64,
	namespace string,
	execution *commonpb.WorkflowExecution,
	workflowType *commonpb.WorkflowType,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddChildWorkflowExecutionTimedOutEvent

func (b *HistoryBuilder) AddChildWorkflowExecutionTimedOutEvent(
	initiatedID int64,
	startedID int64,
	namespace string,
	execution *commonpb.WorkflowExecution,
	workflowType *commonpb.WorkflowType,
	retryState enumspb.RetryState,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddCompletedWorkflowEvent

func (b *HistoryBuilder) AddCompletedWorkflowEvent(
	workflowTaskCompletedEventID int64,
	command *commandpb.CompleteWorkflowExecutionCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddContinuedAsNewEvent

func (b *HistoryBuilder) AddContinuedAsNewEvent(
	workflowTaskCompletedEventID int64,
	newRunID string,
	command *commandpb.ContinueAsNewWorkflowExecutionCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddExternalWorkflowExecutionCancelRequested

func (b *HistoryBuilder) AddExternalWorkflowExecutionCancelRequested(
	initiatedEventID int64,
	namespace string,
	workflowID string,
	runID string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddExternalWorkflowExecutionSignaled

func (b *HistoryBuilder) AddExternalWorkflowExecutionSignaled(
	initiatedEventID int64,
	namespace string,
	workflowID string,
	runID string,
	control string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddFailWorkflowEvent

func (b *HistoryBuilder) AddFailWorkflowEvent(
	workflowTaskCompletedEventID int64,
	retryState enumspb.RetryState,
	command *commandpb.FailWorkflowExecutionCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddMarkerRecordedEvent

func (b *HistoryBuilder) AddMarkerRecordedEvent(
	workflowTaskCompletedEventID int64,
	command *commandpb.RecordMarkerCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddRequestCancelExternalWorkflowExecutionFailedEvent

func (b *HistoryBuilder) AddRequestCancelExternalWorkflowExecutionFailedEvent(
	workflowTaskCompletedEventID int64,
	initiatedEventID int64,
	namespace string,
	workflowID string,
	runID string,
	cause enumspb.CancelExternalWorkflowExecutionFailedCause,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddRequestCancelExternalWorkflowExecutionInitiatedEvent

func (b *HistoryBuilder) AddRequestCancelExternalWorkflowExecutionInitiatedEvent(
	workflowTaskCompletedEventID int64,
	command *commandpb.RequestCancelExternalWorkflowExecutionCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddSignalExternalWorkflowExecutionFailedEvent

func (b *HistoryBuilder) AddSignalExternalWorkflowExecutionFailedEvent(
	workflowTaskCompletedEventID int64,
	initiatedEventID int64,
	namespace string,
	workflowID string,
	runID string,
	control string,
	cause enumspb.SignalExternalWorkflowExecutionFailedCause,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddSignalExternalWorkflowExecutionInitiatedEvent

func (b *HistoryBuilder) AddSignalExternalWorkflowExecutionInitiatedEvent(
	workflowTaskCompletedEventID int64,
	command *commandpb.SignalExternalWorkflowExecutionCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddStartChildWorkflowExecutionFailedEvent

func (b *HistoryBuilder) AddStartChildWorkflowExecutionFailedEvent(
	workflowTaskCompletedEventID int64,
	initiatedID int64,
	cause enumspb.StartChildWorkflowExecutionFailedCause,
	namespace string,
	workflowID string,
	workflowType *commonpb.WorkflowType,
	control string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddStartChildWorkflowExecutionInitiatedEvent

func (b *HistoryBuilder) AddStartChildWorkflowExecutionInitiatedEvent(
	workflowTaskCompletedEventID int64,
	command *commandpb.StartChildWorkflowExecutionCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddTimeoutWorkflowEvent

func (b *HistoryBuilder) AddTimeoutWorkflowEvent(
	retryState enumspb.RetryState,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddTimerCanceledEvent

func (b *HistoryBuilder) AddTimerCanceledEvent(
	workflowTaskCompletedEventID int64,
	startedEventID int64,
	timerID string,
	identity string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddTimerFiredEvent

func (b *HistoryBuilder) AddTimerFiredEvent(
	startedEventID int64,
	timerID string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddTimerStartedEvent

func (b *HistoryBuilder) AddTimerStartedEvent(
	workflowTaskCompletedEventID int64,
	command *commandpb.StartTimerCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddUpsertWorkflowSearchAttributesEvent

func (b *HistoryBuilder) AddUpsertWorkflowSearchAttributesEvent(
	workflowTaskCompletedEventID int64,
	command *commandpb.UpsertWorkflowSearchAttributesCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddWorkflowExecutionCancelRequestedEvent

func (b *HistoryBuilder) AddWorkflowExecutionCancelRequestedEvent(
	request *historyservice.RequestCancelWorkflowExecutionRequest,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddWorkflowExecutionCanceledEvent

func (b *HistoryBuilder) AddWorkflowExecutionCanceledEvent(
	workflowTaskCompletedEventID int64,
	command *commandpb.CancelWorkflowExecutionCommandAttributes,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddWorkflowExecutionSignaledEvent

func (b *HistoryBuilder) AddWorkflowExecutionSignaledEvent(
	signalName string,
	input *commonpb.Payloads,
	identity string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddWorkflowExecutionStartedEvent

func (b *HistoryBuilder) AddWorkflowExecutionStartedEvent(
	startTime time.Time,
	request *historyservice.StartWorkflowExecutionRequest,
	resetPoints *workflowpb.ResetPoints,
	prevRunID string,
	firstRunID string,
	originalRunID string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddWorkflowExecutionTerminatedEvent

func (b *HistoryBuilder) AddWorkflowExecutionTerminatedEvent(
	reason string,
	details *commonpb.Payloads,
	identity string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddWorkflowTaskCompletedEvent

func (b *HistoryBuilder) AddWorkflowTaskCompletedEvent(
	scheduleEventID int64,
	startedEventID int64,
	identity string,
	checksum string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddWorkflowTaskFailedEvent

func (b *HistoryBuilder) AddWorkflowTaskFailedEvent(
	scheduleEventID int64,
	startedEventID int64,
	cause enumspb.WorkflowTaskFailedCause,
	failure *failurepb.Failure,
	identity string,
	baseRunID string,
	newRunID string,
	forkEventVersion int64,
	checksum string,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddWorkflowTaskScheduledEvent

func (b *HistoryBuilder) AddWorkflowTaskScheduledEvent(
	taskQueue *taskqueuepb.TaskQueue,
	startToCloseTimeoutSeconds int32,
	attempt int32,
	now time.Time,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddWorkflowTaskStartedEvent

func (b *HistoryBuilder) AddWorkflowTaskStartedEvent(
	scheduleEventID int64,
	requestID string,
	identity string,
	now time.Time,
) *historypb.HistoryEvent

func (*HistoryBuilder) AddWorkflowTaskTimedOutEvent

func (b *HistoryBuilder) AddWorkflowTaskTimedOutEvent(
	scheduleEventID int64,
	startedEventID int64,
	timeoutType enumspb.TimeoutType,
) *historypb.HistoryEvent

func (*HistoryBuilder) BufferEventSize

func (b *HistoryBuilder) BufferEventSize() int

func (*HistoryBuilder) Finish

func (b *HistoryBuilder) Finish(
	flushBufferEvent bool,
) (*HistoryMutation, error)

func (*HistoryBuilder) FlushAndCreateNewBatch

func (b *HistoryBuilder) FlushAndCreateNewBatch()

func (*HistoryBuilder) FlushBufferToCurrentBatch

func (b *HistoryBuilder) FlushBufferToCurrentBatch() map[int64]int64

func (*HistoryBuilder) GetAndRemoveTimerFireEvent

func (b *HistoryBuilder) GetAndRemoveTimerFireEvent(
	timerID string,
) *historypb.HistoryEvent

func (*HistoryBuilder) HasActivityFinishEvent

func (b *HistoryBuilder) HasActivityFinishEvent(
	scheduleID int64,
) bool

func (*HistoryBuilder) HasBufferEvents

func (b *HistoryBuilder) HasBufferEvents() bool

func (*HistoryBuilder) NextEventID

func (b *HistoryBuilder) NextEventID() int64

type HistoryBuilderState

type HistoryBuilderState int

TODO should the reorderFunc functionality be ported?

type HistoryMutation

type HistoryMutation struct {
	// events to be persist to events table
	DBEventsBatches [][]*historypb.HistoryEvent
	// events to be buffer in execution table
	DBBufferBatch []*historypb.HistoryEvent
	// whether to clear buffer events on DB
	DBClearBuffer bool
	// accumulated buffered events, equal to all buffer events from execution table
	MemBufferBatch []*historypb.HistoryEvent
	// schedule to start event ID mapping for flushed buffered event
	ScheduleIDToStartID map[int64]int64
}

TODO should the reorderFunc functionality be ported?

type TaskIDGenerator

type TaskIDGenerator func(number int) ([]int64, error)

TODO should the reorderFunc functionality be ported?

Jump to

Keyboard shortcuts

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