Files
tasks/service/history/workflow/context_mock.go
Stephan BehnkeandGitHub 9dc2ca1904 Remove ms parameter from UpdateRegistry (#6861)
## What changed?
<!-- Describe what has changed in this PR -->

Removes the `fallbackMutableState` from the workflow context's
`UpdateRegistry` method.

## Why?
<!-- Tell your future self why have you made these changes -->

Not needed anymore. Once
https://github.com/temporalio/temporal/pull/6858 is merged, the
MutableState should always be present in the workflow context.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

Existing tests.

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2024-11-22 10:48:39 -08:00

355 lines
17 KiB
Go

// The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// Code generated by MockGen. DO NOT EDIT.
// Source: context.go
//
// Generated by this command:
//
// mockgen -copyright_file ../../../LICENSE -package workflow -source context.go -destination context_mock.go
//
// Package workflow is a generated GoMock package.
package workflow
import (
context "context"
reflect "reflect"
persistence "go.temporal.io/server/api/persistence/v1"
definition "go.temporal.io/server/common/definition"
locks "go.temporal.io/server/common/locks"
persistence0 "go.temporal.io/server/common/persistence"
shard "go.temporal.io/server/service/history/shard"
update "go.temporal.io/server/service/history/workflow/update"
gomock "go.uber.org/mock/gomock"
)
// MockContext is a mock of Context interface.
type MockContext struct {
ctrl *gomock.Controller
recorder *MockContextMockRecorder
}
// MockContextMockRecorder is the mock recorder for MockContext.
type MockContextMockRecorder struct {
mock *MockContext
}
// NewMockContext creates a new mock instance.
func NewMockContext(ctrl *gomock.Controller) *MockContext {
mock := &MockContext{ctrl: ctrl}
mock.recorder = &MockContextMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockContext) EXPECT() *MockContextMockRecorder {
return m.recorder
}
// Clear mocks base method.
func (m *MockContext) Clear() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Clear")
}
// Clear indicates an expected call of Clear.
func (mr *MockContextMockRecorder) Clear() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Clear", reflect.TypeOf((*MockContext)(nil).Clear))
}
// ConflictResolveWorkflowExecution mocks base method.
func (m *MockContext) ConflictResolveWorkflowExecution(ctx context.Context, shardContext shard.Context, conflictResolveMode persistence0.ConflictResolveWorkflowMode, resetMutableState MutableState, newContext Context, newMutableState MutableState, currentContext Context, currentMutableState MutableState, resetWorkflowTransactionPolicy TransactionPolicy, newWorkflowTransactionPolicy, currentTransactionPolicy *TransactionPolicy) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ConflictResolveWorkflowExecution", ctx, shardContext, conflictResolveMode, resetMutableState, newContext, newMutableState, currentContext, currentMutableState, resetWorkflowTransactionPolicy, newWorkflowTransactionPolicy, currentTransactionPolicy)
ret0, _ := ret[0].(error)
return ret0
}
// ConflictResolveWorkflowExecution indicates an expected call of ConflictResolveWorkflowExecution.
func (mr *MockContextMockRecorder) ConflictResolveWorkflowExecution(ctx, shardContext, conflictResolveMode, resetMutableState, newContext, newMutableState, currentContext, currentMutableState, resetWorkflowTransactionPolicy, newWorkflowTransactionPolicy, currentTransactionPolicy any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConflictResolveWorkflowExecution", reflect.TypeOf((*MockContext)(nil).ConflictResolveWorkflowExecution), ctx, shardContext, conflictResolveMode, resetMutableState, newContext, newMutableState, currentContext, currentMutableState, resetWorkflowTransactionPolicy, newWorkflowTransactionPolicy, currentTransactionPolicy)
}
// CreateWorkflowExecution mocks base method.
func (m *MockContext) CreateWorkflowExecution(ctx context.Context, shardContext shard.Context, createMode persistence0.CreateWorkflowMode, prevRunID string, prevLastWriteVersion int64, newMutableState MutableState, newWorkflow *persistence0.WorkflowSnapshot, newWorkflowEvents []*persistence0.WorkflowEvents) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateWorkflowExecution", ctx, shardContext, createMode, prevRunID, prevLastWriteVersion, newMutableState, newWorkflow, newWorkflowEvents)
ret0, _ := ret[0].(error)
return ret0
}
// CreateWorkflowExecution indicates an expected call of CreateWorkflowExecution.
func (mr *MockContextMockRecorder) CreateWorkflowExecution(ctx, shardContext, createMode, prevRunID, prevLastWriteVersion, newMutableState, newWorkflow, newWorkflowEvents any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateWorkflowExecution", reflect.TypeOf((*MockContext)(nil).CreateWorkflowExecution), ctx, shardContext, createMode, prevRunID, prevLastWriteVersion, newMutableState, newWorkflow, newWorkflowEvents)
}
// GetWorkflowKey mocks base method.
func (m *MockContext) GetWorkflowKey() definition.WorkflowKey {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetWorkflowKey")
ret0, _ := ret[0].(definition.WorkflowKey)
return ret0
}
// GetWorkflowKey indicates an expected call of GetWorkflowKey.
func (mr *MockContextMockRecorder) GetWorkflowKey() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkflowKey", reflect.TypeOf((*MockContext)(nil).GetWorkflowKey))
}
// IsDirty mocks base method.
func (m *MockContext) IsDirty() bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IsDirty")
ret0, _ := ret[0].(bool)
return ret0
}
// IsDirty indicates an expected call of IsDirty.
func (mr *MockContextMockRecorder) IsDirty() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDirty", reflect.TypeOf((*MockContext)(nil).IsDirty))
}
// LoadExecutionStats mocks base method.
func (m *MockContext) LoadExecutionStats(ctx context.Context, shardContext shard.Context) (*persistence.ExecutionStats, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "LoadExecutionStats", ctx, shardContext)
ret0, _ := ret[0].(*persistence.ExecutionStats)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// LoadExecutionStats indicates an expected call of LoadExecutionStats.
func (mr *MockContextMockRecorder) LoadExecutionStats(ctx, shardContext any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LoadExecutionStats", reflect.TypeOf((*MockContext)(nil).LoadExecutionStats), ctx, shardContext)
}
// LoadMutableState mocks base method.
func (m *MockContext) LoadMutableState(ctx context.Context, shardContext shard.Context) (MutableState, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "LoadMutableState", ctx, shardContext)
ret0, _ := ret[0].(MutableState)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// LoadMutableState indicates an expected call of LoadMutableState.
func (mr *MockContextMockRecorder) LoadMutableState(ctx, shardContext any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LoadMutableState", reflect.TypeOf((*MockContext)(nil).LoadMutableState), ctx, shardContext)
}
// Lock mocks base method.
func (m *MockContext) Lock(ctx context.Context, lockPriority locks.Priority) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Lock", ctx, lockPriority)
ret0, _ := ret[0].(error)
return ret0
}
// Lock indicates an expected call of Lock.
func (mr *MockContextMockRecorder) Lock(ctx, lockPriority any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lock", reflect.TypeOf((*MockContext)(nil).Lock), ctx, lockPriority)
}
// PersistWorkflowEvents mocks base method.
func (m *MockContext) PersistWorkflowEvents(ctx context.Context, shardContext shard.Context, workflowEventsSlice ...*persistence0.WorkflowEvents) (int64, error) {
m.ctrl.T.Helper()
varargs := []any{ctx, shardContext}
for _, a := range workflowEventsSlice {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "PersistWorkflowEvents", varargs...)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// PersistWorkflowEvents indicates an expected call of PersistWorkflowEvents.
func (mr *MockContextMockRecorder) PersistWorkflowEvents(ctx, shardContext any, workflowEventsSlice ...any) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{ctx, shardContext}, workflowEventsSlice...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PersistWorkflowEvents", reflect.TypeOf((*MockContext)(nil).PersistWorkflowEvents), varargs...)
}
// ReapplyEvents mocks base method.
func (m *MockContext) ReapplyEvents(ctx context.Context, shardContext shard.Context, eventBatches []*persistence0.WorkflowEvents) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ReapplyEvents", ctx, shardContext, eventBatches)
ret0, _ := ret[0].(error)
return ret0
}
// ReapplyEvents indicates an expected call of ReapplyEvents.
func (mr *MockContextMockRecorder) ReapplyEvents(ctx, shardContext, eventBatches any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReapplyEvents", reflect.TypeOf((*MockContext)(nil).ReapplyEvents), ctx, shardContext, eventBatches)
}
// RefreshTasks mocks base method.
func (m *MockContext) RefreshTasks(ctx context.Context, shardContext shard.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RefreshTasks", ctx, shardContext)
ret0, _ := ret[0].(error)
return ret0
}
// RefreshTasks indicates an expected call of RefreshTasks.
func (mr *MockContextMockRecorder) RefreshTasks(ctx, shardContext any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RefreshTasks", reflect.TypeOf((*MockContext)(nil).RefreshTasks), ctx, shardContext)
}
// SetWorkflowExecution mocks base method.
func (m *MockContext) SetWorkflowExecution(ctx context.Context, shardContext shard.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetWorkflowExecution", ctx, shardContext)
ret0, _ := ret[0].(error)
return ret0
}
// SetWorkflowExecution indicates an expected call of SetWorkflowExecution.
func (mr *MockContextMockRecorder) SetWorkflowExecution(ctx, shardContext any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWorkflowExecution", reflect.TypeOf((*MockContext)(nil).SetWorkflowExecution), ctx, shardContext)
}
// SubmitClosedWorkflowSnapshot mocks base method.
func (m *MockContext) SubmitClosedWorkflowSnapshot(ctx context.Context, shardContext shard.Context, transactionPolicy TransactionPolicy) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SubmitClosedWorkflowSnapshot", ctx, shardContext, transactionPolicy)
ret0, _ := ret[0].(error)
return ret0
}
// SubmitClosedWorkflowSnapshot indicates an expected call of SubmitClosedWorkflowSnapshot.
func (mr *MockContextMockRecorder) SubmitClosedWorkflowSnapshot(ctx, shardContext, transactionPolicy any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitClosedWorkflowSnapshot", reflect.TypeOf((*MockContext)(nil).SubmitClosedWorkflowSnapshot), ctx, shardContext, transactionPolicy)
}
// Unlock mocks base method.
func (m *MockContext) Unlock() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Unlock")
}
// Unlock indicates an expected call of Unlock.
func (mr *MockContextMockRecorder) Unlock() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unlock", reflect.TypeOf((*MockContext)(nil).Unlock))
}
// UpdateRegistry mocks base method.
func (m *MockContext) UpdateRegistry(ctx context.Context) update.Registry {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UpdateRegistry", ctx)
ret0, _ := ret[0].(update.Registry)
return ret0
}
// UpdateRegistry indicates an expected call of UpdateRegistry.
func (mr *MockContextMockRecorder) UpdateRegistry(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRegistry", reflect.TypeOf((*MockContext)(nil).UpdateRegistry), ctx)
}
// UpdateWorkflowExecutionAsActive mocks base method.
func (m *MockContext) UpdateWorkflowExecutionAsActive(ctx context.Context, shardContext shard.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UpdateWorkflowExecutionAsActive", ctx, shardContext)
ret0, _ := ret[0].(error)
return ret0
}
// UpdateWorkflowExecutionAsActive indicates an expected call of UpdateWorkflowExecutionAsActive.
func (mr *MockContextMockRecorder) UpdateWorkflowExecutionAsActive(ctx, shardContext any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkflowExecutionAsActive", reflect.TypeOf((*MockContext)(nil).UpdateWorkflowExecutionAsActive), ctx, shardContext)
}
// UpdateWorkflowExecutionAsPassive mocks base method.
func (m *MockContext) UpdateWorkflowExecutionAsPassive(ctx context.Context, shardContext shard.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UpdateWorkflowExecutionAsPassive", ctx, shardContext)
ret0, _ := ret[0].(error)
return ret0
}
// UpdateWorkflowExecutionAsPassive indicates an expected call of UpdateWorkflowExecutionAsPassive.
func (mr *MockContextMockRecorder) UpdateWorkflowExecutionAsPassive(ctx, shardContext any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkflowExecutionAsPassive", reflect.TypeOf((*MockContext)(nil).UpdateWorkflowExecutionAsPassive), ctx, shardContext)
}
// UpdateWorkflowExecutionWithNew mocks base method.
func (m *MockContext) UpdateWorkflowExecutionWithNew(ctx context.Context, shardContext shard.Context, updateMode persistence0.UpdateWorkflowMode, newContext Context, newMutableState MutableState, updateWorkflowTransactionPolicy TransactionPolicy, newWorkflowTransactionPolicy *TransactionPolicy) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UpdateWorkflowExecutionWithNew", ctx, shardContext, updateMode, newContext, newMutableState, updateWorkflowTransactionPolicy, newWorkflowTransactionPolicy)
ret0, _ := ret[0].(error)
return ret0
}
// UpdateWorkflowExecutionWithNew indicates an expected call of UpdateWorkflowExecutionWithNew.
func (mr *MockContextMockRecorder) UpdateWorkflowExecutionWithNew(ctx, shardContext, updateMode, newContext, newMutableState, updateWorkflowTransactionPolicy, newWorkflowTransactionPolicy any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkflowExecutionWithNew", reflect.TypeOf((*MockContext)(nil).UpdateWorkflowExecutionWithNew), ctx, shardContext, updateMode, newContext, newMutableState, updateWorkflowTransactionPolicy, newWorkflowTransactionPolicy)
}
// UpdateWorkflowExecutionWithNewAsActive mocks base method.
func (m *MockContext) UpdateWorkflowExecutionWithNewAsActive(ctx context.Context, shardContext shard.Context, newContext Context, newMutableState MutableState) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UpdateWorkflowExecutionWithNewAsActive", ctx, shardContext, newContext, newMutableState)
ret0, _ := ret[0].(error)
return ret0
}
// UpdateWorkflowExecutionWithNewAsActive indicates an expected call of UpdateWorkflowExecutionWithNewAsActive.
func (mr *MockContextMockRecorder) UpdateWorkflowExecutionWithNewAsActive(ctx, shardContext, newContext, newMutableState any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkflowExecutionWithNewAsActive", reflect.TypeOf((*MockContext)(nil).UpdateWorkflowExecutionWithNewAsActive), ctx, shardContext, newContext, newMutableState)
}
// UpdateWorkflowExecutionWithNewAsPassive mocks base method.
func (m *MockContext) UpdateWorkflowExecutionWithNewAsPassive(ctx context.Context, shardContext shard.Context, newContext Context, newMutableState MutableState) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UpdateWorkflowExecutionWithNewAsPassive", ctx, shardContext, newContext, newMutableState)
ret0, _ := ret[0].(error)
return ret0
}
// UpdateWorkflowExecutionWithNewAsPassive indicates an expected call of UpdateWorkflowExecutionWithNewAsPassive.
func (mr *MockContextMockRecorder) UpdateWorkflowExecutionWithNewAsPassive(ctx, shardContext, newContext, newMutableState any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkflowExecutionWithNewAsPassive", reflect.TypeOf((*MockContext)(nil).UpdateWorkflowExecutionWithNewAsPassive), ctx, shardContext, newContext, newMutableState)
}