mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
## What changed? - Start honoring the new `reset_reapply_exclude_types` request field added in https://github.com/temporalio/api/pull/348 - Change all reapply codepaths to specify excluded event types rather than included - Pass the set of excluded types further down the stack - Delete a pointless helper function ## Why? - We must honor the new request field because it is in the API and it is how we are going to control update reapply when we implement that - The previous code was not future-proof: there were various codepaths passing `enumspb.RESET_REAPPLY_TYPE_SIGNAL` to mean "reapply everything". This PR changes those codepaths to pass an empty set of exclusions, which is robust to future additions of new reappliable event types. - The actual work is done by `reapplyEvents`, and the excluded types had to be pushed all the way down the stack to this function. The previous code was pretty fragile: it checked that the caller had requested reapplication of signals and then let the downstream code reapply everything. ## How did you test it? - Unit tests ## Potential risks - It could break replication, and reset ## Is hotfix candidate? - No
77 lines
3.8 KiB
Go
77 lines
3.8 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: workflow_resetter.go
|
|
|
|
// Package ndc is a generated GoMock package.
|
|
package ndc
|
|
|
|
import (
|
|
context "context"
|
|
reflect "reflect"
|
|
|
|
gomock "github.com/golang/mock/gomock"
|
|
v1 "go.temporal.io/api/enums/v1"
|
|
v10 "go.temporal.io/api/history/v1"
|
|
namespace "go.temporal.io/server/common/namespace"
|
|
)
|
|
|
|
// MockWorkflowResetter is a mock of WorkflowResetter interface.
|
|
type MockWorkflowResetter struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockWorkflowResetterMockRecorder
|
|
}
|
|
|
|
// MockWorkflowResetterMockRecorder is the mock recorder for MockWorkflowResetter.
|
|
type MockWorkflowResetterMockRecorder struct {
|
|
mock *MockWorkflowResetter
|
|
}
|
|
|
|
// NewMockWorkflowResetter creates a new mock instance.
|
|
func NewMockWorkflowResetter(ctrl *gomock.Controller) *MockWorkflowResetter {
|
|
mock := &MockWorkflowResetter{ctrl: ctrl}
|
|
mock.recorder = &MockWorkflowResetterMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockWorkflowResetter) EXPECT() *MockWorkflowResetterMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// ResetWorkflow mocks base method.
|
|
func (m *MockWorkflowResetter) ResetWorkflow(ctx context.Context, namespaceID namespace.ID, workflowID, baseRunID string, baseBranchToken []byte, baseRebuildLastEventID, baseRebuildLastEventVersion, baseNextEventID int64, resetRunID, resetRequestID string, currentWorkflow Workflow, resetReason string, additionalReapplyEvents []*v10.HistoryEvent, resetReapplyExcludeTypes map[v1.ResetReapplyExcludeType]bool) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ResetWorkflow", ctx, namespaceID, workflowID, baseRunID, baseBranchToken, baseRebuildLastEventID, baseRebuildLastEventVersion, baseNextEventID, resetRunID, resetRequestID, currentWorkflow, resetReason, additionalReapplyEvents, resetReapplyExcludeTypes)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// ResetWorkflow indicates an expected call of ResetWorkflow.
|
|
func (mr *MockWorkflowResetterMockRecorder) ResetWorkflow(ctx, namespaceID, workflowID, baseRunID, baseBranchToken, baseRebuildLastEventID, baseRebuildLastEventVersion, baseNextEventID, resetRunID, resetRequestID, currentWorkflow, resetReason, additionalReapplyEvents, resetReapplyExcludeTypes interface{}) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetWorkflow", reflect.TypeOf((*MockWorkflowResetter)(nil).ResetWorkflow), ctx, namespaceID, workflowID, baseRunID, baseBranchToken, baseRebuildLastEventID, baseRebuildLastEventVersion, baseNextEventID, resetRunID, resetRequestID, currentWorkflow, resetReason, additionalReapplyEvents, resetReapplyExcludeTypes)
|
|
}
|