mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed? <!-- Describe what has changed in this PR --> Use code generation for fault injection stores. ## Why? <!-- Tell your future self why have you made these changes --> They all are the same, and code can be generated. Also removed reflection from hot code path. Follow up for #5886. ## How did you test it? <!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? --> Compile. ## Potential risks <!-- Assuming the worst case, what can be broken when deploying this change to production? --> No risks. ## 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/`? --> No. ## Is hotfix candidate? <!-- Is this PR a hotfix candidate or does it require a notification to be sent to the broader community? (Yes/No) --> No.
288 lines
10 KiB
Go
288 lines
10 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 cmd/tools/genfaultinjection. DO NOT EDIT.
|
|
|
|
package faultinjection
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.temporal.io/server/common/persistence"
|
|
)
|
|
|
|
type (
|
|
faultInjectionExecutionStore struct {
|
|
baseStore persistence.ExecutionStore
|
|
generator faultGenerator
|
|
}
|
|
)
|
|
|
|
func newFaultInjectionExecutionStore(
|
|
baseStore persistence.ExecutionStore,
|
|
generator faultGenerator,
|
|
) *faultInjectionExecutionStore {
|
|
return &faultInjectionExecutionStore{
|
|
baseStore: baseStore,
|
|
generator: generator,
|
|
}
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) AddHistoryTasks(
|
|
ctx context.Context,
|
|
request *persistence.InternalAddHistoryTasksRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("AddHistoryTasks"), func() error {
|
|
return c.baseStore.AddHistoryTasks(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) AppendHistoryNodes(
|
|
ctx context.Context,
|
|
request *persistence.InternalAppendHistoryNodesRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("AppendHistoryNodes"), func() error {
|
|
return c.baseStore.AppendHistoryNodes(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) Close() {
|
|
c.baseStore.Close()
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) CompleteHistoryTask(
|
|
ctx context.Context,
|
|
request *persistence.CompleteHistoryTaskRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("CompleteHistoryTask"), func() error {
|
|
return c.baseStore.CompleteHistoryTask(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) ConflictResolveWorkflowExecution(
|
|
ctx context.Context,
|
|
request *persistence.InternalConflictResolveWorkflowExecutionRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("ConflictResolveWorkflowExecution"), func() error {
|
|
return c.baseStore.ConflictResolveWorkflowExecution(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) CreateWorkflowExecution(
|
|
ctx context.Context,
|
|
request *persistence.InternalCreateWorkflowExecutionRequest,
|
|
) (*persistence.InternalCreateWorkflowExecutionResponse, error) {
|
|
return inject1(c.generator.generate("CreateWorkflowExecution"), func() (*persistence.InternalCreateWorkflowExecutionResponse, error) {
|
|
return c.baseStore.CreateWorkflowExecution(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) DeleteCurrentWorkflowExecution(
|
|
ctx context.Context,
|
|
request *persistence.DeleteCurrentWorkflowExecutionRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("DeleteCurrentWorkflowExecution"), func() error {
|
|
return c.baseStore.DeleteCurrentWorkflowExecution(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) DeleteHistoryBranch(
|
|
ctx context.Context,
|
|
request *persistence.InternalDeleteHistoryBranchRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("DeleteHistoryBranch"), func() error {
|
|
return c.baseStore.DeleteHistoryBranch(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) DeleteHistoryNodes(
|
|
ctx context.Context,
|
|
request *persistence.InternalDeleteHistoryNodesRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("DeleteHistoryNodes"), func() error {
|
|
return c.baseStore.DeleteHistoryNodes(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) DeleteReplicationTaskFromDLQ(
|
|
ctx context.Context,
|
|
request *persistence.DeleteReplicationTaskFromDLQRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("DeleteReplicationTaskFromDLQ"), func() error {
|
|
return c.baseStore.DeleteReplicationTaskFromDLQ(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) DeleteWorkflowExecution(
|
|
ctx context.Context,
|
|
request *persistence.DeleteWorkflowExecutionRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("DeleteWorkflowExecution"), func() error {
|
|
return c.baseStore.DeleteWorkflowExecution(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) ForkHistoryBranch(
|
|
ctx context.Context,
|
|
request *persistence.InternalForkHistoryBranchRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("ForkHistoryBranch"), func() error {
|
|
return c.baseStore.ForkHistoryBranch(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) GetAllHistoryTreeBranches(
|
|
ctx context.Context,
|
|
request *persistence.GetAllHistoryTreeBranchesRequest,
|
|
) (*persistence.InternalGetAllHistoryTreeBranchesResponse, error) {
|
|
return inject1(c.generator.generate("GetAllHistoryTreeBranches"), func() (*persistence.InternalGetAllHistoryTreeBranchesResponse, error) {
|
|
return c.baseStore.GetAllHistoryTreeBranches(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) GetCurrentExecution(
|
|
ctx context.Context,
|
|
request *persistence.GetCurrentExecutionRequest,
|
|
) (*persistence.InternalGetCurrentExecutionResponse, error) {
|
|
return inject1(c.generator.generate("GetCurrentExecution"), func() (*persistence.InternalGetCurrentExecutionResponse, error) {
|
|
return c.baseStore.GetCurrentExecution(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) GetHistoryBranchUtil() persistence.HistoryBranchUtil {
|
|
return c.baseStore.GetHistoryBranchUtil()
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) GetHistoryTasks(
|
|
ctx context.Context,
|
|
request *persistence.GetHistoryTasksRequest,
|
|
) (*persistence.InternalGetHistoryTasksResponse, error) {
|
|
return inject1(c.generator.generate("GetHistoryTasks"), func() (*persistence.InternalGetHistoryTasksResponse, error) {
|
|
return c.baseStore.GetHistoryTasks(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) GetHistoryTreeContainingBranch(
|
|
ctx context.Context,
|
|
request *persistence.InternalGetHistoryTreeContainingBranchRequest,
|
|
) (*persistence.InternalGetHistoryTreeContainingBranchResponse, error) {
|
|
return inject1(c.generator.generate("GetHistoryTreeContainingBranch"), func() (*persistence.InternalGetHistoryTreeContainingBranchResponse, error) {
|
|
return c.baseStore.GetHistoryTreeContainingBranch(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) GetName() string {
|
|
return c.baseStore.GetName()
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) GetReplicationTasksFromDLQ(
|
|
ctx context.Context,
|
|
request *persistence.GetReplicationTasksFromDLQRequest,
|
|
) (*persistence.InternalGetHistoryTasksResponse, error) {
|
|
return inject1(c.generator.generate("GetReplicationTasksFromDLQ"), func() (*persistence.InternalGetHistoryTasksResponse, error) {
|
|
return c.baseStore.GetReplicationTasksFromDLQ(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) GetWorkflowExecution(
|
|
ctx context.Context,
|
|
request *persistence.GetWorkflowExecutionRequest,
|
|
) (*persistence.InternalGetWorkflowExecutionResponse, error) {
|
|
return inject1(c.generator.generate("GetWorkflowExecution"), func() (*persistence.InternalGetWorkflowExecutionResponse, error) {
|
|
return c.baseStore.GetWorkflowExecution(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) IsReplicationDLQEmpty(
|
|
ctx context.Context,
|
|
request *persistence.GetReplicationTasksFromDLQRequest,
|
|
) (bool, error) {
|
|
return inject1(c.generator.generate("IsReplicationDLQEmpty"), func() (bool, error) {
|
|
return c.baseStore.IsReplicationDLQEmpty(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) ListConcreteExecutions(
|
|
ctx context.Context,
|
|
request *persistence.ListConcreteExecutionsRequest,
|
|
) (*persistence.InternalListConcreteExecutionsResponse, error) {
|
|
return inject1(c.generator.generate("ListConcreteExecutions"), func() (*persistence.InternalListConcreteExecutionsResponse, error) {
|
|
return c.baseStore.ListConcreteExecutions(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) PutReplicationTaskToDLQ(
|
|
ctx context.Context,
|
|
request *persistence.PutReplicationTaskToDLQRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("PutReplicationTaskToDLQ"), func() error {
|
|
return c.baseStore.PutReplicationTaskToDLQ(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) RangeCompleteHistoryTasks(
|
|
ctx context.Context,
|
|
request *persistence.RangeCompleteHistoryTasksRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("RangeCompleteHistoryTasks"), func() error {
|
|
return c.baseStore.RangeCompleteHistoryTasks(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) RangeDeleteReplicationTaskFromDLQ(
|
|
ctx context.Context,
|
|
request *persistence.RangeDeleteReplicationTaskFromDLQRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("RangeDeleteReplicationTaskFromDLQ"), func() error {
|
|
return c.baseStore.RangeDeleteReplicationTaskFromDLQ(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) ReadHistoryBranch(
|
|
ctx context.Context,
|
|
request *persistence.InternalReadHistoryBranchRequest,
|
|
) (*persistence.InternalReadHistoryBranchResponse, error) {
|
|
return inject1(c.generator.generate("ReadHistoryBranch"), func() (*persistence.InternalReadHistoryBranchResponse, error) {
|
|
return c.baseStore.ReadHistoryBranch(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) SetWorkflowExecution(
|
|
ctx context.Context,
|
|
request *persistence.InternalSetWorkflowExecutionRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("SetWorkflowExecution"), func() error {
|
|
return c.baseStore.SetWorkflowExecution(ctx, request)
|
|
})
|
|
}
|
|
|
|
func (c *faultInjectionExecutionStore) UpdateWorkflowExecution(
|
|
ctx context.Context,
|
|
request *persistence.InternalUpdateWorkflowExecutionRequest,
|
|
) error {
|
|
return inject0(c.generator.generate("UpdateWorkflowExecution"), func() error {
|
|
return c.baseStore.UpdateWorkflowExecution(ctx, request)
|
|
})
|
|
}
|