From 3b1532f91b6c56495888b200615687ac6410587d Mon Sep 17 00:00:00 2001 From: Stephan Behnke Date: Tue, 7 Jan 2025 14:58:19 -0800 Subject: [PATCH 1/2] gowrap fault injection --- Makefile | 10 +- cmd/tools/genfaultinjection/main.go | 238 ------------- .../cluster_metadata_store_gen.go | 110 +++--- .../faultinjection/execution_store_gen.go | 330 +++++++++--------- common/persistence/faultinjection/fault.go | 31 +- .../faultinjection/gowrap_template | 34 ++ .../faultinjection/metadata_store_gen.go | 116 +++--- .../nexus_endpoint_store_gen.go | 74 ++-- .../persistence/faultinjection/queue_gen.go | 159 ++++----- .../faultinjection/queue_v2_gen.go | 76 ++-- .../faultinjection/shard_store_gen.go | 66 ++-- .../faultinjection/task_store_gen.go | 180 +++++----- common/persistence/persistence_interface.go | 3 - 13 files changed, 582 insertions(+), 845 deletions(-) delete mode 100644 cmd/tools/genfaultinjection/main.go create mode 100644 common/persistence/faultinjection/gowrap_template diff --git a/Makefile b/Makefile index aad638726ec..e2957f8038e 100644 --- a/Makefile +++ b/Makefile @@ -211,6 +211,13 @@ $(STAMPDIR)/goimports-$(GOIMPORTS_VER): | $(STAMPDIR) $(LOCALBIN) @touch $@ $(GOIMPORTS): $(STAMPDIR)/goimports-$(GOIMPORTS_VER) +GOWRAP_VER := v1.4.1 +GOWRAP := $(LOCALBIN)/gowrap +$(STAMPDIR)/gowrap-$(GOWRAP_VER): | $(STAMPDIR) $(LOCALBIN) + $(call go-install-tool,$(GOWRAP),github.com/hexdigest/gowrap/cmd/gowrap,$(GOWRAP_VER)) + @touch $@ +$(GOWRAP): $(STAMPDIR)/gowrap-$(GOWRAP_VER) + # Mockgen is called by name throughout the codebase, so we need to keep the binary name consistent MOCKGEN_VER := v0.4.0 MOCKGEN := $(LOCALBIN)/mockgen @@ -601,9 +608,10 @@ update-dependencies: @go get -u -t $(PINNED_DEPENDENCIES) ./... @go mod tidy -go-generate: $(MOCKGEN) $(GOIMPORTS) $(STRINGER) +go-generate: $(MOCKGEN) $(GOIMPORTS) $(STRINGER) $(GOWRAP) @printf $(COLOR) "Process go:generate directives..." @go generate ./... + $(MAKE) copyright ensure-no-changes: @printf $(COLOR) "Check for local changes..." diff --git a/cmd/tools/genfaultinjection/main.go b/cmd/tools/genfaultinjection/main.go deleted file mode 100644 index c8b892807c8..00000000000 --- a/cmd/tools/genfaultinjection/main.go +++ /dev/null @@ -1,238 +0,0 @@ -// 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. - -package main - -import ( - "flag" - "fmt" - "io" - "log" - "os" - "path" - "reflect" - "strings" - "text/template" - - "go.temporal.io/server/common/persistence" -) - -var extraImports = map[string][]string{ - "Queue": {"go.temporal.io/api/common/v1"}, -} - -func main() { - outPathFlag := flag.String("out", ".", "path to write generated files") - licenseFlag := flag.String("copyright_file", "../../../LICENSE", "path to license to copy into header") - flag.Parse() - - licenseText := readLicenseFile(*licenseFlag) - - for _, store := range stores() { - callWithFile(generateFaultInjectionStore, store, *outPathFlag, licenseText) - } -} - -func stores() []reflect.Type { - factoryT := reflect.TypeOf((*persistence.DataStoreFactory)(nil)).Elem() - var storeTs []reflect.Type - for i := 0; i < factoryT.NumMethod(); i++ { - ctor := factoryT.Method(i) - if !strings.HasPrefix(ctor.Name, "New") { - continue - } - if ctor.Type.NumOut() == 0 { - continue - } - storeT := ctor.Type.Out(0) - storeTs = append(storeTs, storeT) - } - return storeTs -} - -func callWithFile(generator func(io.Writer, reflect.Type), store reflect.Type, outPath string, licenseText string) { - filename := path.Join(outPath, camelCaseToSnakeCase(store.Name())+"_gen.go") - w, err := os.Create(filename) - fatalIfErr(err) - defer func() { - fatalIfErr(w.Close()) - }() - _, err = fmt.Fprintf(w, "%s\n// Code generated by cmd/tools/genfaultinjection. DO NOT EDIT.\n", licenseText) - fatalIfErr(err) - generator(w, store) -} - -func generateFaultInjectionStore(w io.Writer, store reflect.Type) { - writeStoreHeader(w, store, ` -package faultinjection - -import ( - "context" -{{range .ExtraImports}} - {{printf "%q" .}} -{{- end}} - "go.temporal.io/server/common/persistence" -) - -type ( - faultInjection{{.StoreName}} struct { - baseStore persistence.{{.StoreName}} - generator faultGenerator - } -) - -func newFaultInjection{{.StoreName}}( - baseStore persistence.{{.StoreName}}, - generator faultGenerator, -) *faultInjection{{.StoreName}} { - return &faultInjection{{.StoreName}}{ - baseStore: baseStore, - generator: generator, - } -} -`) - - writeStoreMethods(w, store, ` -func (c *faultInjection{{.StoreName}}) {{.MethodName}}({{.InParams}}){{.OutParams}} { - return inject{{.NumOutParams}}(c.generator.generate("{{.MethodName}}"), func(){{.OutParams}} { - return c.baseStore.{{.MethodName}}({{.InVars}}) - }) -} -`, ` -func (c *faultInjection{{.StoreName}}) {{.MethodName}}({{.InParams}}){{.OutParams}} { - {{if ne .OutParams ""}}return {{end}}c.baseStore.{{.MethodName}}({{.InVars}}) -} -`) -} - -func writeStoreHeader(w io.Writer, store reflect.Type, tmpl string) { - fatalIfErr(template.Must(template.New("code").Parse(tmpl)).Execute(w, map[string]any{ - "StoreName": store.Name(), - "ExtraImports": extraImports[store.Name()], - })) -} - -func writeStoreMethods(w io.Writer, store reflect.Type, tmpl string, passThroughTmpl string) { - for i := 0; i < store.NumMethod(); i++ { - writeStoreMethod(w, store, store.Method(i), tmpl, passThroughTmpl) - } -} - -func writeStoreMethod(w io.Writer, store reflect.Type, m reflect.Method, tmpl string, passThroughTmpl string) { - - mT := m.Type - inParams := "" - inVars := "" - for i := 0; i < mT.NumIn(); i++ { - pName := fmt.Sprintf("p%d", i) - // Special names for ctx and request for better intellisense support. - if mT.In(i).String() == "context.Context" { - pName = "ctx" - } else if strings.HasSuffix(mT.In(i).String(), "Request") { - pName = "request" - } - inParams += fmt.Sprintf("\n\t%s %s,", pName, mT.In(i).String()) - inVars += fmt.Sprintf("%s, ", pName) - } - if mT.NumIn() > 0 { - // Remove trailing ", " if any. - inVars = inVars[:len(inVars)-2] - inParams += "\n" - } - - outParams := "" - for i := 0; i < mT.NumOut(); i++ { - outParams += fmt.Sprintf("%s, ", mT.Out(i).String()) - } - if mT.NumOut() > 0 { - // Remove trailing ", " if any. - outParams = outParams[:len(outParams)-2] - if mT.NumOut() > 1 { - outParams = fmt.Sprintf(" (%s)", outParams) - } else { - outParams = fmt.Sprintf(" %s", outParams) - } - } - - fields := map[string]any{ - "StoreName": store.Name(), - "MethodName": m.Name, - "InParams": inParams, - "InVars": inVars, - "OutParams": outParams, - "NumOutParams": mT.NumOut() - 1, - } - - var t string - if mT.NumIn() > 1 && mT.In(0).String() == "context.Context" && - mT.NumOut() > 0 && mT.Out(mT.NumOut()-1).String() == "error" { - // Fault injection only for methods which look like: - // ListClusterMetadata(ctx context.Context, ...) (..., error) - t = tmpl - } else { - // Others (i.e. GetName, Close, etc.) just pass through. - t = passThroughTmpl - } - - fatalIfErr(template.Must(template.New("code").Parse(t)).Execute(w, fields)) -} - -func readLicenseFile(filePath string) string { - text, err := os.ReadFile(filePath) - if err != nil { - panic(err) - } - var lines []string - for _, line := range strings.Split(string(text), "\n") { - lines = append(lines, strings.TrimRight("// "+line, " ")) - } - return strings.Join(lines, "\n") + "\n" -} -func fatalIfErr(err error) { - if err != nil { - //nolint:revive // calls to log.Fatal only in main() or init() functions (revive) - log.Fatal(err) - } -} - -func camelCaseToSnakeCase(s string) string { - if s == "" { - return "" - } - t := make([]rune, 0, len(s)+5) - for i, c := range s { - if isASCIIUpper(c) { - if i != 0 { - t = append(t, '_') - } - c ^= ' ' // Make it a lower letter. - } - t = append(t, c) - } - return string(t) -} - -func isASCIIUpper(c rune) bool { - return 'A' <= c && c <= 'Z' -} diff --git a/common/persistence/faultinjection/cluster_metadata_store_gen.go b/common/persistence/faultinjection/cluster_metadata_store_gen.go index a7297d33dce..151292da087 100644 --- a/common/persistence/faultinjection/cluster_metadata_store_gen.go +++ b/common/persistence/faultinjection/cluster_metadata_store_gen.go @@ -22,100 +22,98 @@ // 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. +// Code generated by gowrap. DO NOT EDIT. +// template: gowrap_template +// gowrap: http://github.com/hexdigest/gowrap package faultinjection +//go:generate gowrap gen -p go.temporal.io/server/common/persistence -i ClusterMetadataStore -t gowrap_template -o cluster_metadata_store_gen.go -l "" + import ( "context" - "go.temporal.io/server/common/persistence" + _sourcePersistence "go.temporal.io/server/common/persistence" ) type ( + // faultInjectionClusterMetadataStore implements ClusterMetadataStore interface with fault injection. faultInjectionClusterMetadataStore struct { - baseStore persistence.ClusterMetadataStore + _sourcePersistence.ClusterMetadataStore generator faultGenerator } ) +// newFaultInjectionClusterMetadataStore returns faultInjectionClusterMetadataStore. func newFaultInjectionClusterMetadataStore( - baseStore persistence.ClusterMetadataStore, + baseStore _sourcePersistence.ClusterMetadataStore, generator faultGenerator, ) *faultInjectionClusterMetadataStore { return &faultInjectionClusterMetadataStore{ - baseStore: baseStore, - generator: generator, + ClusterMetadataStore: baseStore, + generator: generator, } } -func (c *faultInjectionClusterMetadataStore) Close() { - c.baseStore.Close() -} - -func (c *faultInjectionClusterMetadataStore) DeleteClusterMetadata( - ctx context.Context, - request *persistence.InternalDeleteClusterMetadataRequest, -) error { - return inject0(c.generator.generate("DeleteClusterMetadata"), func() error { - return c.baseStore.DeleteClusterMetadata(ctx, request) +// DeleteClusterMetadata wraps ClusterMetadataStore.DeleteClusterMetadata. +func (_d faultInjectionClusterMetadataStore) DeleteClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalDeleteClusterMetadataRequest) (err error) { + err = _d.generator.generate("DeleteClusterMetadata").inject(func() error { + err = _d.ClusterMetadataStore.DeleteClusterMetadata(ctx, request) + return err }) + return } -func (c *faultInjectionClusterMetadataStore) GetClusterMembers( - ctx context.Context, - request *persistence.GetClusterMembersRequest, -) (*persistence.GetClusterMembersResponse, error) { - return inject1(c.generator.generate("GetClusterMembers"), func() (*persistence.GetClusterMembersResponse, error) { - return c.baseStore.GetClusterMembers(ctx, request) +// GetClusterMembers wraps ClusterMetadataStore.GetClusterMembers. +func (_d faultInjectionClusterMetadataStore) GetClusterMembers(ctx context.Context, request *_sourcePersistence.GetClusterMembersRequest) (gp1 *_sourcePersistence.GetClusterMembersResponse, err error) { + err = _d.generator.generate("GetClusterMembers").inject(func() error { + gp1, err = _d.ClusterMetadataStore.GetClusterMembers(ctx, request) + return err }) + return } -func (c *faultInjectionClusterMetadataStore) GetClusterMetadata( - ctx context.Context, - request *persistence.InternalGetClusterMetadataRequest, -) (*persistence.InternalGetClusterMetadataResponse, error) { - return inject1(c.generator.generate("GetClusterMetadata"), func() (*persistence.InternalGetClusterMetadataResponse, error) { - return c.baseStore.GetClusterMetadata(ctx, request) +// GetClusterMetadata wraps ClusterMetadataStore.GetClusterMetadata. +func (_d faultInjectionClusterMetadataStore) GetClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalGetClusterMetadataRequest) (ip1 *_sourcePersistence.InternalGetClusterMetadataResponse, err error) { + err = _d.generator.generate("GetClusterMetadata").inject(func() error { + ip1, err = _d.ClusterMetadataStore.GetClusterMetadata(ctx, request) + return err }) + return } -func (c *faultInjectionClusterMetadataStore) GetName() string { - return c.baseStore.GetName() -} - -func (c *faultInjectionClusterMetadataStore) ListClusterMetadata( - ctx context.Context, - request *persistence.InternalListClusterMetadataRequest, -) (*persistence.InternalListClusterMetadataResponse, error) { - return inject1(c.generator.generate("ListClusterMetadata"), func() (*persistence.InternalListClusterMetadataResponse, error) { - return c.baseStore.ListClusterMetadata(ctx, request) +// ListClusterMetadata wraps ClusterMetadataStore.ListClusterMetadata. +func (_d faultInjectionClusterMetadataStore) ListClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalListClusterMetadataRequest) (ip1 *_sourcePersistence.InternalListClusterMetadataResponse, err error) { + err = _d.generator.generate("ListClusterMetadata").inject(func() error { + ip1, err = _d.ClusterMetadataStore.ListClusterMetadata(ctx, request) + return err }) + return } -func (c *faultInjectionClusterMetadataStore) PruneClusterMembership( - ctx context.Context, - request *persistence.PruneClusterMembershipRequest, -) error { - return inject0(c.generator.generate("PruneClusterMembership"), func() error { - return c.baseStore.PruneClusterMembership(ctx, request) +// PruneClusterMembership wraps ClusterMetadataStore.PruneClusterMembership. +func (_d faultInjectionClusterMetadataStore) PruneClusterMembership(ctx context.Context, request *_sourcePersistence.PruneClusterMembershipRequest) (err error) { + err = _d.generator.generate("PruneClusterMembership").inject(func() error { + err = _d.ClusterMetadataStore.PruneClusterMembership(ctx, request) + return err }) + return } -func (c *faultInjectionClusterMetadataStore) SaveClusterMetadata( - ctx context.Context, - request *persistence.InternalSaveClusterMetadataRequest, -) (bool, error) { - return inject1(c.generator.generate("SaveClusterMetadata"), func() (bool, error) { - return c.baseStore.SaveClusterMetadata(ctx, request) +// SaveClusterMetadata wraps ClusterMetadataStore.SaveClusterMetadata. +func (_d faultInjectionClusterMetadataStore) SaveClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalSaveClusterMetadataRequest) (b1 bool, err error) { + err = _d.generator.generate("SaveClusterMetadata").inject(func() error { + b1, err = _d.ClusterMetadataStore.SaveClusterMetadata(ctx, request) + return err }) + return } -func (c *faultInjectionClusterMetadataStore) UpsertClusterMembership( - ctx context.Context, - request *persistence.UpsertClusterMembershipRequest, -) error { - return inject0(c.generator.generate("UpsertClusterMembership"), func() error { - return c.baseStore.UpsertClusterMembership(ctx, request) +// UpsertClusterMembership wraps ClusterMetadataStore.UpsertClusterMembership. +func (_d faultInjectionClusterMetadataStore) UpsertClusterMembership(ctx context.Context, request *_sourcePersistence.UpsertClusterMembershipRequest) (err error) { + err = _d.generator.generate("UpsertClusterMembership").inject(func() error { + err = _d.ClusterMetadataStore.UpsertClusterMembership(ctx, request) + return err }) + return } diff --git a/common/persistence/faultinjection/execution_store_gen.go b/common/persistence/faultinjection/execution_store_gen.go index 7737be7d755..8cd2e962e3c 100644 --- a/common/persistence/faultinjection/execution_store_gen.go +++ b/common/persistence/faultinjection/execution_store_gen.go @@ -22,266 +22,260 @@ // 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. +// Code generated by gowrap. DO NOT EDIT. +// template: gowrap_template +// gowrap: http://github.com/hexdigest/gowrap package faultinjection +//go:generate gowrap gen -p go.temporal.io/server/common/persistence -i ExecutionStore -t gowrap_template -o execution_store_gen.go -l "" + import ( "context" - "go.temporal.io/server/common/persistence" + _sourcePersistence "go.temporal.io/server/common/persistence" ) type ( + // faultInjectionExecutionStore implements ExecutionStore interface with fault injection. faultInjectionExecutionStore struct { - baseStore persistence.ExecutionStore + _sourcePersistence.ExecutionStore generator faultGenerator } ) +// newFaultInjectionExecutionStore returns faultInjectionExecutionStore. func newFaultInjectionExecutionStore( - baseStore persistence.ExecutionStore, + baseStore _sourcePersistence.ExecutionStore, generator faultGenerator, ) *faultInjectionExecutionStore { return &faultInjectionExecutionStore{ - baseStore: baseStore, - generator: generator, + ExecutionStore: 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) +// AddHistoryTasks wraps ExecutionStore.AddHistoryTasks. +func (_d faultInjectionExecutionStore) AddHistoryTasks(ctx context.Context, request *_sourcePersistence.InternalAddHistoryTasksRequest) (err error) { + err = _d.generator.generate("AddHistoryTasks").inject(func() error { + err = _d.ExecutionStore.AddHistoryTasks(ctx, request) + return err }) + return } -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) +// AppendHistoryNodes wraps ExecutionStore.AppendHistoryNodes. +func (_d faultInjectionExecutionStore) AppendHistoryNodes(ctx context.Context, request *_sourcePersistence.InternalAppendHistoryNodesRequest) (err error) { + err = _d.generator.generate("AppendHistoryNodes").inject(func() error { + err = _d.ExecutionStore.AppendHistoryNodes(ctx, request) + return err }) + return } -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) +// CompleteHistoryTask wraps ExecutionStore.CompleteHistoryTask. +func (_d faultInjectionExecutionStore) CompleteHistoryTask(ctx context.Context, request *_sourcePersistence.CompleteHistoryTaskRequest) (err error) { + err = _d.generator.generate("CompleteHistoryTask").inject(func() error { + err = _d.ExecutionStore.CompleteHistoryTask(ctx, request) + return err }) + return } -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) +// ConflictResolveWorkflowExecution wraps ExecutionStore.ConflictResolveWorkflowExecution. +func (_d faultInjectionExecutionStore) ConflictResolveWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalConflictResolveWorkflowExecutionRequest) (err error) { + err = _d.generator.generate("ConflictResolveWorkflowExecution").inject(func() error { + err = _d.ExecutionStore.ConflictResolveWorkflowExecution(ctx, request) + return err }) + return } -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) +// CreateWorkflowExecution wraps ExecutionStore.CreateWorkflowExecution. +func (_d faultInjectionExecutionStore) CreateWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalCreateWorkflowExecutionRequest) (ip1 *_sourcePersistence.InternalCreateWorkflowExecutionResponse, err error) { + err = _d.generator.generate("CreateWorkflowExecution").inject(func() error { + ip1, err = _d.ExecutionStore.CreateWorkflowExecution(ctx, request) + return err }) + return } -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) +// DeleteCurrentWorkflowExecution wraps ExecutionStore.DeleteCurrentWorkflowExecution. +func (_d faultInjectionExecutionStore) DeleteCurrentWorkflowExecution(ctx context.Context, request *_sourcePersistence.DeleteCurrentWorkflowExecutionRequest) (err error) { + err = _d.generator.generate("DeleteCurrentWorkflowExecution").inject(func() error { + err = _d.ExecutionStore.DeleteCurrentWorkflowExecution(ctx, request) + return err }) + return } -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) +// DeleteHistoryBranch wraps ExecutionStore.DeleteHistoryBranch. +func (_d faultInjectionExecutionStore) DeleteHistoryBranch(ctx context.Context, request *_sourcePersistence.InternalDeleteHistoryBranchRequest) (err error) { + err = _d.generator.generate("DeleteHistoryBranch").inject(func() error { + err = _d.ExecutionStore.DeleteHistoryBranch(ctx, request) + return err }) + return } -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) +// DeleteHistoryNodes wraps ExecutionStore.DeleteHistoryNodes. +func (_d faultInjectionExecutionStore) DeleteHistoryNodes(ctx context.Context, request *_sourcePersistence.InternalDeleteHistoryNodesRequest) (err error) { + err = _d.generator.generate("DeleteHistoryNodes").inject(func() error { + err = _d.ExecutionStore.DeleteHistoryNodes(ctx, request) + return err }) + return } -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) +// DeleteReplicationTaskFromDLQ wraps ExecutionStore.DeleteReplicationTaskFromDLQ. +func (_d faultInjectionExecutionStore) DeleteReplicationTaskFromDLQ(ctx context.Context, request *_sourcePersistence.DeleteReplicationTaskFromDLQRequest) (err error) { + err = _d.generator.generate("DeleteReplicationTaskFromDLQ").inject(func() error { + err = _d.ExecutionStore.DeleteReplicationTaskFromDLQ(ctx, request) + return err }) + return } -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) +// DeleteWorkflowExecution wraps ExecutionStore.DeleteWorkflowExecution. +func (_d faultInjectionExecutionStore) DeleteWorkflowExecution(ctx context.Context, request *_sourcePersistence.DeleteWorkflowExecutionRequest) (err error) { + err = _d.generator.generate("DeleteWorkflowExecution").inject(func() error { + err = _d.ExecutionStore.DeleteWorkflowExecution(ctx, request) + return err }) + return } -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) +// ForkHistoryBranch wraps ExecutionStore.ForkHistoryBranch. +func (_d faultInjectionExecutionStore) ForkHistoryBranch(ctx context.Context, request *_sourcePersistence.InternalForkHistoryBranchRequest) (err error) { + err = _d.generator.generate("ForkHistoryBranch").inject(func() error { + err = _d.ExecutionStore.ForkHistoryBranch(ctx, request) + return err }) + return } -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) +// GetAllHistoryTreeBranches wraps ExecutionStore.GetAllHistoryTreeBranches. +func (_d faultInjectionExecutionStore) GetAllHistoryTreeBranches(ctx context.Context, request *_sourcePersistence.GetAllHistoryTreeBranchesRequest) (ip1 *_sourcePersistence.InternalGetAllHistoryTreeBranchesResponse, err error) { + err = _d.generator.generate("GetAllHistoryTreeBranches").inject(func() error { + ip1, err = _d.ExecutionStore.GetAllHistoryTreeBranches(ctx, request) + return err }) + return } -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) +// GetCurrentExecution wraps ExecutionStore.GetCurrentExecution. +func (_d faultInjectionExecutionStore) GetCurrentExecution(ctx context.Context, request *_sourcePersistence.GetCurrentExecutionRequest) (ip1 *_sourcePersistence.InternalGetCurrentExecutionResponse, err error) { + err = _d.generator.generate("GetCurrentExecution").inject(func() error { + ip1, err = _d.ExecutionStore.GetCurrentExecution(ctx, request) + return err }) + return } -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) +// GetHistoryTasks wraps ExecutionStore.GetHistoryTasks. +func (_d faultInjectionExecutionStore) GetHistoryTasks(ctx context.Context, request *_sourcePersistence.GetHistoryTasksRequest) (ip1 *_sourcePersistence.InternalGetHistoryTasksResponse, err error) { + err = _d.generator.generate("GetHistoryTasks").inject(func() error { + ip1, err = _d.ExecutionStore.GetHistoryTasks(ctx, request) + return err }) + return } -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) +// GetHistoryTreeContainingBranch wraps ExecutionStore.GetHistoryTreeContainingBranch. +func (_d faultInjectionExecutionStore) GetHistoryTreeContainingBranch(ctx context.Context, request *_sourcePersistence.InternalGetHistoryTreeContainingBranchRequest) (ip1 *_sourcePersistence.InternalGetHistoryTreeContainingBranchResponse, err error) { + err = _d.generator.generate("GetHistoryTreeContainingBranch").inject(func() error { + ip1, err = _d.ExecutionStore.GetHistoryTreeContainingBranch(ctx, request) + return err }) + return } -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) +// GetReplicationTasksFromDLQ wraps ExecutionStore.GetReplicationTasksFromDLQ. +func (_d faultInjectionExecutionStore) GetReplicationTasksFromDLQ(ctx context.Context, request *_sourcePersistence.GetReplicationTasksFromDLQRequest) (ip1 *_sourcePersistence.InternalGetReplicationTasksFromDLQResponse, err error) { + err = _d.generator.generate("GetReplicationTasksFromDLQ").inject(func() error { + ip1, err = _d.ExecutionStore.GetReplicationTasksFromDLQ(ctx, request) + return err }) + return } -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) +// GetWorkflowExecution wraps ExecutionStore.GetWorkflowExecution. +func (_d faultInjectionExecutionStore) GetWorkflowExecution(ctx context.Context, request *_sourcePersistence.GetWorkflowExecutionRequest) (ip1 *_sourcePersistence.InternalGetWorkflowExecutionResponse, err error) { + err = _d.generator.generate("GetWorkflowExecution").inject(func() error { + ip1, err = _d.ExecutionStore.GetWorkflowExecution(ctx, request) + return err }) + return } -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) +// IsReplicationDLQEmpty wraps ExecutionStore.IsReplicationDLQEmpty. +func (_d faultInjectionExecutionStore) IsReplicationDLQEmpty(ctx context.Context, request *_sourcePersistence.GetReplicationTasksFromDLQRequest) (b1 bool, err error) { + err = _d.generator.generate("IsReplicationDLQEmpty").inject(func() error { + b1, err = _d.ExecutionStore.IsReplicationDLQEmpty(ctx, request) + return err }) + return } -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) +// ListConcreteExecutions wraps ExecutionStore.ListConcreteExecutions. +func (_d faultInjectionExecutionStore) ListConcreteExecutions(ctx context.Context, request *_sourcePersistence.ListConcreteExecutionsRequest) (ip1 *_sourcePersistence.InternalListConcreteExecutionsResponse, err error) { + err = _d.generator.generate("ListConcreteExecutions").inject(func() error { + ip1, err = _d.ExecutionStore.ListConcreteExecutions(ctx, request) + return err }) + return } -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) +// PutReplicationTaskToDLQ wraps ExecutionStore.PutReplicationTaskToDLQ. +func (_d faultInjectionExecutionStore) PutReplicationTaskToDLQ(ctx context.Context, request *_sourcePersistence.PutReplicationTaskToDLQRequest) (err error) { + err = _d.generator.generate("PutReplicationTaskToDLQ").inject(func() error { + err = _d.ExecutionStore.PutReplicationTaskToDLQ(ctx, request) + return err }) + return } -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) +// RangeCompleteHistoryTasks wraps ExecutionStore.RangeCompleteHistoryTasks. +func (_d faultInjectionExecutionStore) RangeCompleteHistoryTasks(ctx context.Context, request *_sourcePersistence.RangeCompleteHistoryTasksRequest) (err error) { + err = _d.generator.generate("RangeCompleteHistoryTasks").inject(func() error { + err = _d.ExecutionStore.RangeCompleteHistoryTasks(ctx, request) + return err }) + return } -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) +// RangeDeleteReplicationTaskFromDLQ wraps ExecutionStore.RangeDeleteReplicationTaskFromDLQ. +func (_d faultInjectionExecutionStore) RangeDeleteReplicationTaskFromDLQ(ctx context.Context, request *_sourcePersistence.RangeDeleteReplicationTaskFromDLQRequest) (err error) { + err = _d.generator.generate("RangeDeleteReplicationTaskFromDLQ").inject(func() error { + err = _d.ExecutionStore.RangeDeleteReplicationTaskFromDLQ(ctx, request) + return err }) + return } -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) +// ReadHistoryBranch wraps ExecutionStore.ReadHistoryBranch. +func (_d faultInjectionExecutionStore) ReadHistoryBranch(ctx context.Context, request *_sourcePersistence.InternalReadHistoryBranchRequest) (ip1 *_sourcePersistence.InternalReadHistoryBranchResponse, err error) { + err = _d.generator.generate("ReadHistoryBranch").inject(func() error { + ip1, err = _d.ExecutionStore.ReadHistoryBranch(ctx, request) + return err }) + return } -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) +// SetWorkflowExecution wraps ExecutionStore.SetWorkflowExecution. +func (_d faultInjectionExecutionStore) SetWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalSetWorkflowExecutionRequest) (err error) { + err = _d.generator.generate("SetWorkflowExecution").inject(func() error { + err = _d.ExecutionStore.SetWorkflowExecution(ctx, request) + return err }) + return } -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) +// UpdateWorkflowExecution wraps ExecutionStore.UpdateWorkflowExecution. +func (_d faultInjectionExecutionStore) UpdateWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalUpdateWorkflowExecutionRequest) (err error) { + err = _d.generator.generate("UpdateWorkflowExecution").inject(func() error { + err = _d.ExecutionStore.UpdateWorkflowExecution(ctx, request) + return err }) + return } diff --git a/common/persistence/faultinjection/fault.go b/common/persistence/faultinjection/fault.go index b2da900db89..259baa59025 100644 --- a/common/persistence/faultinjection/fault.go +++ b/common/persistence/faultinjection/fault.go @@ -82,8 +82,7 @@ func newFault(errName string, errRate float64, methodName string) fault { } } -// Not receiver on a *fault because of generics. -func inject0(f *fault, op func() error) error { +func (f *fault) inject(op func() error) error { if f == nil { return op() } @@ -95,31 +94,3 @@ func inject0(f *fault, op func() error) error { } return f.err } - -func inject1[T1 any](f *fault, op func() (T1, error)) (T1, error) { - if f == nil { - return op() - } - if f.execOp { - r1, err := op() - if err != nil { - return r1, err - } - } - var nilT1 T1 - return nilT1, f.err -} -func inject2[T1 any, T2 any](f *fault, op func() (T1, T2, error)) (T1, T2, error) { - if f == nil { - return op() - } - if f.execOp { - r1, r2, err := op() - if err != nil { - return r1, r2, err - } - } - var nilT1 T1 - var nilT2 T2 - return nilT1, nilT2, f.err -} diff --git a/common/persistence/faultinjection/gowrap_template b/common/persistence/faultinjection/gowrap_template new file mode 100644 index 00000000000..f19daf4202f --- /dev/null +++ b/common/persistence/faultinjection/gowrap_template @@ -0,0 +1,34 @@ +{{ $decorator := (or .Vars.DecoratorName (printf "faultInjection%s" .Interface.Name)) }} + +type ( + // {{$decorator}} implements {{.Interface.Name}} interface with fault injection. + {{$decorator}} struct { + {{.Interface.Type}} + generator faultGenerator + } +) + +// new{{upFirst $decorator}} returns {{$decorator}}. +func new{{upFirst $decorator}} ( + baseStore {{.Interface.Type}}, + generator faultGenerator, +) *{{$decorator}} { + return &{{$decorator}} { + {{.Interface.Name}}: baseStore, + generator: generator, + } +} + +{{range $method := .Interface.Methods}} + {{if (and $method.AcceptsContext (gt (len $method.Params) 1)) }} + {{ $methodIdent := (printf "%s.%s" $.Interface.Name $method.Name) }} + // {{$method.Name}} wraps {{ (printf "%s.%s" $.Interface.Name $method.Name) }}. + func (_d {{$decorator}}) {{$method.Declaration}} { + err = _d.generator.generate("{{ $method.Name }}").inject(func() error { + {{$method.ResultsNames}} = _d.{{$.Interface.Name}}.{{$method.Call}} + return err + }) + return + } + {{end}} +{{end}} diff --git a/common/persistence/faultinjection/metadata_store_gen.go b/common/persistence/faultinjection/metadata_store_gen.go index 1569cda2bc4..d7cb4acdd96 100644 --- a/common/persistence/faultinjection/metadata_store_gen.go +++ b/common/persistence/faultinjection/metadata_store_gen.go @@ -22,106 +22,98 @@ // 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. +// Code generated by gowrap. DO NOT EDIT. +// template: gowrap_template +// gowrap: http://github.com/hexdigest/gowrap package faultinjection +//go:generate gowrap gen -p go.temporal.io/server/common/persistence -i MetadataStore -t gowrap_template -o metadata_store_gen.go -l "" + import ( "context" - "go.temporal.io/server/common/persistence" + _sourcePersistence "go.temporal.io/server/common/persistence" ) type ( + // faultInjectionMetadataStore implements MetadataStore interface with fault injection. faultInjectionMetadataStore struct { - baseStore persistence.MetadataStore + _sourcePersistence.MetadataStore generator faultGenerator } ) +// newFaultInjectionMetadataStore returns faultInjectionMetadataStore. func newFaultInjectionMetadataStore( - baseStore persistence.MetadataStore, + baseStore _sourcePersistence.MetadataStore, generator faultGenerator, ) *faultInjectionMetadataStore { return &faultInjectionMetadataStore{ - baseStore: baseStore, - generator: generator, + MetadataStore: baseStore, + generator: generator, } } -func (c *faultInjectionMetadataStore) Close() { - c.baseStore.Close() -} - -func (c *faultInjectionMetadataStore) CreateNamespace( - ctx context.Context, - request *persistence.InternalCreateNamespaceRequest, -) (*persistence.CreateNamespaceResponse, error) { - return inject1(c.generator.generate("CreateNamespace"), func() (*persistence.CreateNamespaceResponse, error) { - return c.baseStore.CreateNamespace(ctx, request) +// CreateNamespace wraps MetadataStore.CreateNamespace. +func (_d faultInjectionMetadataStore) CreateNamespace(ctx context.Context, request *_sourcePersistence.InternalCreateNamespaceRequest) (cp1 *_sourcePersistence.CreateNamespaceResponse, err error) { + err = _d.generator.generate("CreateNamespace").inject(func() error { + cp1, err = _d.MetadataStore.CreateNamespace(ctx, request) + return err }) + return } -func (c *faultInjectionMetadataStore) DeleteNamespace( - ctx context.Context, - request *persistence.DeleteNamespaceRequest, -) error { - return inject0(c.generator.generate("DeleteNamespace"), func() error { - return c.baseStore.DeleteNamespace(ctx, request) +// DeleteNamespace wraps MetadataStore.DeleteNamespace. +func (_d faultInjectionMetadataStore) DeleteNamespace(ctx context.Context, request *_sourcePersistence.DeleteNamespaceRequest) (err error) { + err = _d.generator.generate("DeleteNamespace").inject(func() error { + err = _d.MetadataStore.DeleteNamespace(ctx, request) + return err }) + return } -func (c *faultInjectionMetadataStore) DeleteNamespaceByName( - ctx context.Context, - request *persistence.DeleteNamespaceByNameRequest, -) error { - return inject0(c.generator.generate("DeleteNamespaceByName"), func() error { - return c.baseStore.DeleteNamespaceByName(ctx, request) +// DeleteNamespaceByName wraps MetadataStore.DeleteNamespaceByName. +func (_d faultInjectionMetadataStore) DeleteNamespaceByName(ctx context.Context, request *_sourcePersistence.DeleteNamespaceByNameRequest) (err error) { + err = _d.generator.generate("DeleteNamespaceByName").inject(func() error { + err = _d.MetadataStore.DeleteNamespaceByName(ctx, request) + return err }) + return } -func (c *faultInjectionMetadataStore) GetMetadata( - ctx context.Context, -) (*persistence.GetMetadataResponse, error) { - return c.baseStore.GetMetadata(ctx) -} - -func (c *faultInjectionMetadataStore) GetName() string { - return c.baseStore.GetName() -} - -func (c *faultInjectionMetadataStore) GetNamespace( - ctx context.Context, - request *persistence.GetNamespaceRequest, -) (*persistence.InternalGetNamespaceResponse, error) { - return inject1(c.generator.generate("GetNamespace"), func() (*persistence.InternalGetNamespaceResponse, error) { - return c.baseStore.GetNamespace(ctx, request) +// GetNamespace wraps MetadataStore.GetNamespace. +func (_d faultInjectionMetadataStore) GetNamespace(ctx context.Context, request *_sourcePersistence.GetNamespaceRequest) (ip1 *_sourcePersistence.InternalGetNamespaceResponse, err error) { + err = _d.generator.generate("GetNamespace").inject(func() error { + ip1, err = _d.MetadataStore.GetNamespace(ctx, request) + return err }) + return } -func (c *faultInjectionMetadataStore) ListNamespaces( - ctx context.Context, - request *persistence.InternalListNamespacesRequest, -) (*persistence.InternalListNamespacesResponse, error) { - return inject1(c.generator.generate("ListNamespaces"), func() (*persistence.InternalListNamespacesResponse, error) { - return c.baseStore.ListNamespaces(ctx, request) +// ListNamespaces wraps MetadataStore.ListNamespaces. +func (_d faultInjectionMetadataStore) ListNamespaces(ctx context.Context, request *_sourcePersistence.InternalListNamespacesRequest) (ip1 *_sourcePersistence.InternalListNamespacesResponse, err error) { + err = _d.generator.generate("ListNamespaces").inject(func() error { + ip1, err = _d.MetadataStore.ListNamespaces(ctx, request) + return err }) + return } -func (c *faultInjectionMetadataStore) RenameNamespace( - ctx context.Context, - request *persistence.InternalRenameNamespaceRequest, -) error { - return inject0(c.generator.generate("RenameNamespace"), func() error { - return c.baseStore.RenameNamespace(ctx, request) +// RenameNamespace wraps MetadataStore.RenameNamespace. +func (_d faultInjectionMetadataStore) RenameNamespace(ctx context.Context, request *_sourcePersistence.InternalRenameNamespaceRequest) (err error) { + err = _d.generator.generate("RenameNamespace").inject(func() error { + err = _d.MetadataStore.RenameNamespace(ctx, request) + return err }) + return } -func (c *faultInjectionMetadataStore) UpdateNamespace( - ctx context.Context, - request *persistence.InternalUpdateNamespaceRequest, -) error { - return inject0(c.generator.generate("UpdateNamespace"), func() error { - return c.baseStore.UpdateNamespace(ctx, request) +// UpdateNamespace wraps MetadataStore.UpdateNamespace. +func (_d faultInjectionMetadataStore) UpdateNamespace(ctx context.Context, request *_sourcePersistence.InternalUpdateNamespaceRequest) (err error) { + err = _d.generator.generate("UpdateNamespace").inject(func() error { + err = _d.MetadataStore.UpdateNamespace(ctx, request) + return err }) + return } diff --git a/common/persistence/faultinjection/nexus_endpoint_store_gen.go b/common/persistence/faultinjection/nexus_endpoint_store_gen.go index 1bae203a9ed..b4000c4ca0e 100644 --- a/common/persistence/faultinjection/nexus_endpoint_store_gen.go +++ b/common/persistence/faultinjection/nexus_endpoint_store_gen.go @@ -22,73 +22,71 @@ // 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. +// Code generated by gowrap. DO NOT EDIT. +// template: gowrap_template +// gowrap: http://github.com/hexdigest/gowrap package faultinjection +//go:generate gowrap gen -p go.temporal.io/server/common/persistence -i NexusEndpointStore -t gowrap_template -o nexus_endpoint_store_gen.go -l "" + import ( "context" - "go.temporal.io/server/common/persistence" + _sourcePersistence "go.temporal.io/server/common/persistence" ) type ( + // faultInjectionNexusEndpointStore implements NexusEndpointStore interface with fault injection. faultInjectionNexusEndpointStore struct { - baseStore persistence.NexusEndpointStore + _sourcePersistence.NexusEndpointStore generator faultGenerator } ) +// newFaultInjectionNexusEndpointStore returns faultInjectionNexusEndpointStore. func newFaultInjectionNexusEndpointStore( - baseStore persistence.NexusEndpointStore, + baseStore _sourcePersistence.NexusEndpointStore, generator faultGenerator, ) *faultInjectionNexusEndpointStore { return &faultInjectionNexusEndpointStore{ - baseStore: baseStore, - generator: generator, + NexusEndpointStore: baseStore, + generator: generator, } } -func (c *faultInjectionNexusEndpointStore) Close() { - c.baseStore.Close() -} - -func (c *faultInjectionNexusEndpointStore) CreateOrUpdateNexusEndpoint( - ctx context.Context, - request *persistence.InternalCreateOrUpdateNexusEndpointRequest, -) error { - return inject0(c.generator.generate("CreateOrUpdateNexusEndpoint"), func() error { - return c.baseStore.CreateOrUpdateNexusEndpoint(ctx, request) +// CreateOrUpdateNexusEndpoint wraps NexusEndpointStore.CreateOrUpdateNexusEndpoint. +func (_d faultInjectionNexusEndpointStore) CreateOrUpdateNexusEndpoint(ctx context.Context, request *_sourcePersistence.InternalCreateOrUpdateNexusEndpointRequest) (err error) { + err = _d.generator.generate("CreateOrUpdateNexusEndpoint").inject(func() error { + err = _d.NexusEndpointStore.CreateOrUpdateNexusEndpoint(ctx, request) + return err }) + return } -func (c *faultInjectionNexusEndpointStore) DeleteNexusEndpoint( - ctx context.Context, - request *persistence.DeleteNexusEndpointRequest, -) error { - return inject0(c.generator.generate("DeleteNexusEndpoint"), func() error { - return c.baseStore.DeleteNexusEndpoint(ctx, request) +// DeleteNexusEndpoint wraps NexusEndpointStore.DeleteNexusEndpoint. +func (_d faultInjectionNexusEndpointStore) DeleteNexusEndpoint(ctx context.Context, request *_sourcePersistence.DeleteNexusEndpointRequest) (err error) { + err = _d.generator.generate("DeleteNexusEndpoint").inject(func() error { + err = _d.NexusEndpointStore.DeleteNexusEndpoint(ctx, request) + return err }) + return } -func (c *faultInjectionNexusEndpointStore) GetName() string { - return c.baseStore.GetName() -} - -func (c *faultInjectionNexusEndpointStore) GetNexusEndpoint( - ctx context.Context, - request *persistence.GetNexusEndpointRequest, -) (*persistence.InternalNexusEndpoint, error) { - return inject1(c.generator.generate("GetNexusEndpoint"), func() (*persistence.InternalNexusEndpoint, error) { - return c.baseStore.GetNexusEndpoint(ctx, request) +// GetNexusEndpoint wraps NexusEndpointStore.GetNexusEndpoint. +func (_d faultInjectionNexusEndpointStore) GetNexusEndpoint(ctx context.Context, request *_sourcePersistence.GetNexusEndpointRequest) (ip1 *_sourcePersistence.InternalNexusEndpoint, err error) { + err = _d.generator.generate("GetNexusEndpoint").inject(func() error { + ip1, err = _d.NexusEndpointStore.GetNexusEndpoint(ctx, request) + return err }) + return } -func (c *faultInjectionNexusEndpointStore) ListNexusEndpoints( - ctx context.Context, - request *persistence.ListNexusEndpointsRequest, -) (*persistence.InternalListNexusEndpointsResponse, error) { - return inject1(c.generator.generate("ListNexusEndpoints"), func() (*persistence.InternalListNexusEndpointsResponse, error) { - return c.baseStore.ListNexusEndpoints(ctx, request) +// ListNexusEndpoints wraps NexusEndpointStore.ListNexusEndpoints. +func (_d faultInjectionNexusEndpointStore) ListNexusEndpoints(ctx context.Context, request *_sourcePersistence.ListNexusEndpointsRequest) (ip1 *_sourcePersistence.InternalListNexusEndpointsResponse, err error) { + err = _d.generator.generate("ListNexusEndpoints").inject(func() error { + ip1, err = _d.NexusEndpointStore.ListNexusEndpoints(ctx, request) + return err }) + return } diff --git a/common/persistence/faultinjection/queue_gen.go b/common/persistence/faultinjection/queue_gen.go index e34459ac45b..18ad8e24c06 100644 --- a/common/persistence/faultinjection/queue_gen.go +++ b/common/persistence/faultinjection/queue_gen.go @@ -22,141 +22,126 @@ // 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. +// Code generated by gowrap. DO NOT EDIT. +// template: gowrap_template +// gowrap: http://github.com/hexdigest/gowrap package faultinjection +//go:generate gowrap gen -p go.temporal.io/server/common/persistence -i Queue -t gowrap_template -o queue_gen.go -l "" + import ( "context" - "go.temporal.io/api/common/v1" - "go.temporal.io/server/common/persistence" + commonpb "go.temporal.io/api/common/v1" + _sourcePersistence "go.temporal.io/server/common/persistence" ) type ( + // faultInjectionQueue implements Queue interface with fault injection. faultInjectionQueue struct { - baseStore persistence.Queue + _sourcePersistence.Queue generator faultGenerator } ) +// newFaultInjectionQueue returns faultInjectionQueue. func newFaultInjectionQueue( - baseStore persistence.Queue, + baseStore _sourcePersistence.Queue, generator faultGenerator, ) *faultInjectionQueue { return &faultInjectionQueue{ - baseStore: baseStore, + Queue: baseStore, generator: generator, } } -func (c *faultInjectionQueue) Close() { - c.baseStore.Close() -} - -func (c *faultInjectionQueue) DeleteMessageFromDLQ( - ctx context.Context, - p1 int64, -) error { - return inject0(c.generator.generate("DeleteMessageFromDLQ"), func() error { - return c.baseStore.DeleteMessageFromDLQ(ctx, p1) +// DeleteMessageFromDLQ wraps Queue.DeleteMessageFromDLQ. +func (_d faultInjectionQueue) DeleteMessageFromDLQ(ctx context.Context, messageID int64) (err error) { + err = _d.generator.generate("DeleteMessageFromDLQ").inject(func() error { + err = _d.Queue.DeleteMessageFromDLQ(ctx, messageID) + return err }) + return } -func (c *faultInjectionQueue) DeleteMessagesBefore( - ctx context.Context, - p1 int64, -) error { - return inject0(c.generator.generate("DeleteMessagesBefore"), func() error { - return c.baseStore.DeleteMessagesBefore(ctx, p1) +// DeleteMessagesBefore wraps Queue.DeleteMessagesBefore. +func (_d faultInjectionQueue) DeleteMessagesBefore(ctx context.Context, messageID int64) (err error) { + err = _d.generator.generate("DeleteMessagesBefore").inject(func() error { + err = _d.Queue.DeleteMessagesBefore(ctx, messageID) + return err }) + return } -func (c *faultInjectionQueue) EnqueueMessage( - ctx context.Context, - p1 *common.DataBlob, -) error { - return inject0(c.generator.generate("EnqueueMessage"), func() error { - return c.baseStore.EnqueueMessage(ctx, p1) +// EnqueueMessage wraps Queue.EnqueueMessage. +func (_d faultInjectionQueue) EnqueueMessage(ctx context.Context, blob *commonpb.DataBlob) (err error) { + err = _d.generator.generate("EnqueueMessage").inject(func() error { + err = _d.Queue.EnqueueMessage(ctx, blob) + return err }) + return } -func (c *faultInjectionQueue) EnqueueMessageToDLQ( - ctx context.Context, - p1 *common.DataBlob, -) (int64, error) { - return inject1(c.generator.generate("EnqueueMessageToDLQ"), func() (int64, error) { - return c.baseStore.EnqueueMessageToDLQ(ctx, p1) +// EnqueueMessageToDLQ wraps Queue.EnqueueMessageToDLQ. +func (_d faultInjectionQueue) EnqueueMessageToDLQ(ctx context.Context, blob *commonpb.DataBlob) (i1 int64, err error) { + err = _d.generator.generate("EnqueueMessageToDLQ").inject(func() error { + i1, err = _d.Queue.EnqueueMessageToDLQ(ctx, blob) + return err }) + return } -func (c *faultInjectionQueue) GetAckLevels( - ctx context.Context, -) (*persistence.InternalQueueMetadata, error) { - return c.baseStore.GetAckLevels(ctx) -} - -func (c *faultInjectionQueue) GetDLQAckLevels( - ctx context.Context, -) (*persistence.InternalQueueMetadata, error) { - return c.baseStore.GetDLQAckLevels(ctx) -} - -func (c *faultInjectionQueue) Init( - ctx context.Context, - p1 *common.DataBlob, -) error { - return inject0(c.generator.generate("Init"), func() error { - return c.baseStore.Init(ctx, p1) +// Init wraps Queue.Init. +func (_d faultInjectionQueue) Init(ctx context.Context, blob *commonpb.DataBlob) (err error) { + err = _d.generator.generate("Init").inject(func() error { + err = _d.Queue.Init(ctx, blob) + return err }) + return } -func (c *faultInjectionQueue) RangeDeleteMessagesFromDLQ( - ctx context.Context, - p1 int64, - p2 int64, -) error { - return inject0(c.generator.generate("RangeDeleteMessagesFromDLQ"), func() error { - return c.baseStore.RangeDeleteMessagesFromDLQ(ctx, p1, p2) +// RangeDeleteMessagesFromDLQ wraps Queue.RangeDeleteMessagesFromDLQ. +func (_d faultInjectionQueue) RangeDeleteMessagesFromDLQ(ctx context.Context, firstMessageID int64, lastMessageID int64) (err error) { + err = _d.generator.generate("RangeDeleteMessagesFromDLQ").inject(func() error { + err = _d.Queue.RangeDeleteMessagesFromDLQ(ctx, firstMessageID, lastMessageID) + return err }) + return } -func (c *faultInjectionQueue) ReadMessages( - ctx context.Context, - p1 int64, - p2 int, -) ([]*persistence.QueueMessage, error) { - return inject1(c.generator.generate("ReadMessages"), func() ([]*persistence.QueueMessage, error) { - return c.baseStore.ReadMessages(ctx, p1, p2) +// ReadMessages wraps Queue.ReadMessages. +func (_d faultInjectionQueue) ReadMessages(ctx context.Context, lastMessageID int64, maxCount int) (qpa1 []*_sourcePersistence.QueueMessage, err error) { + err = _d.generator.generate("ReadMessages").inject(func() error { + qpa1, err = _d.Queue.ReadMessages(ctx, lastMessageID, maxCount) + return err }) + return } -func (c *faultInjectionQueue) ReadMessagesFromDLQ( - ctx context.Context, - p1 int64, - p2 int64, - p3 int, - p4 []uint8, -) ([]*persistence.QueueMessage, []uint8, error) { - return inject2(c.generator.generate("ReadMessagesFromDLQ"), func() ([]*persistence.QueueMessage, []uint8, error) { - return c.baseStore.ReadMessagesFromDLQ(ctx, p1, p2, p3, p4) +// ReadMessagesFromDLQ wraps Queue.ReadMessagesFromDLQ. +func (_d faultInjectionQueue) ReadMessagesFromDLQ(ctx context.Context, firstMessageID int64, lastMessageID int64, pageSize int, pageToken []byte) (qpa1 []*_sourcePersistence.QueueMessage, ba1 []byte, err error) { + err = _d.generator.generate("ReadMessagesFromDLQ").inject(func() error { + qpa1, ba1, err = _d.Queue.ReadMessagesFromDLQ(ctx, firstMessageID, lastMessageID, pageSize, pageToken) + return err }) + return } -func (c *faultInjectionQueue) UpdateAckLevel( - ctx context.Context, - p1 *persistence.InternalQueueMetadata, -) error { - return inject0(c.generator.generate("UpdateAckLevel"), func() error { - return c.baseStore.UpdateAckLevel(ctx, p1) +// UpdateAckLevel wraps Queue.UpdateAckLevel. +func (_d faultInjectionQueue) UpdateAckLevel(ctx context.Context, metadata *_sourcePersistence.InternalQueueMetadata) (err error) { + err = _d.generator.generate("UpdateAckLevel").inject(func() error { + err = _d.Queue.UpdateAckLevel(ctx, metadata) + return err }) + return } -func (c *faultInjectionQueue) UpdateDLQAckLevel( - ctx context.Context, - p1 *persistence.InternalQueueMetadata, -) error { - return inject0(c.generator.generate("UpdateDLQAckLevel"), func() error { - return c.baseStore.UpdateDLQAckLevel(ctx, p1) +// UpdateDLQAckLevel wraps Queue.UpdateDLQAckLevel. +func (_d faultInjectionQueue) UpdateDLQAckLevel(ctx context.Context, metadata *_sourcePersistence.InternalQueueMetadata) (err error) { + err = _d.generator.generate("UpdateDLQAckLevel").inject(func() error { + err = _d.Queue.UpdateDLQAckLevel(ctx, metadata) + return err }) + return } diff --git a/common/persistence/faultinjection/queue_v2_gen.go b/common/persistence/faultinjection/queue_v2_gen.go index e45c5e40c02..0f467adc08d 100644 --- a/common/persistence/faultinjection/queue_v2_gen.go +++ b/common/persistence/faultinjection/queue_v2_gen.go @@ -22,74 +22,80 @@ // 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. +// Code generated by gowrap. DO NOT EDIT. +// template: gowrap_template +// gowrap: http://github.com/hexdigest/gowrap package faultinjection +//go:generate gowrap gen -p go.temporal.io/server/common/persistence -i QueueV2 -t gowrap_template -o queue_v2_gen.go -l "" + import ( "context" - "go.temporal.io/server/common/persistence" + _sourcePersistence "go.temporal.io/server/common/persistence" ) type ( + // faultInjectionQueueV2 implements QueueV2 interface with fault injection. faultInjectionQueueV2 struct { - baseStore persistence.QueueV2 + _sourcePersistence.QueueV2 generator faultGenerator } ) +// newFaultInjectionQueueV2 returns faultInjectionQueueV2. func newFaultInjectionQueueV2( - baseStore persistence.QueueV2, + baseStore _sourcePersistence.QueueV2, generator faultGenerator, ) *faultInjectionQueueV2 { return &faultInjectionQueueV2{ - baseStore: baseStore, + QueueV2: baseStore, generator: generator, } } -func (c *faultInjectionQueueV2) CreateQueue( - ctx context.Context, - request *persistence.InternalCreateQueueRequest, -) (*persistence.InternalCreateQueueResponse, error) { - return inject1(c.generator.generate("CreateQueue"), func() (*persistence.InternalCreateQueueResponse, error) { - return c.baseStore.CreateQueue(ctx, request) +// CreateQueue wraps QueueV2.CreateQueue. +func (_d faultInjectionQueueV2) CreateQueue(ctx context.Context, request *_sourcePersistence.InternalCreateQueueRequest) (ip1 *_sourcePersistence.InternalCreateQueueResponse, err error) { + err = _d.generator.generate("CreateQueue").inject(func() error { + ip1, err = _d.QueueV2.CreateQueue(ctx, request) + return err }) + return } -func (c *faultInjectionQueueV2) EnqueueMessage( - ctx context.Context, - request *persistence.InternalEnqueueMessageRequest, -) (*persistence.InternalEnqueueMessageResponse, error) { - return inject1(c.generator.generate("EnqueueMessage"), func() (*persistence.InternalEnqueueMessageResponse, error) { - return c.baseStore.EnqueueMessage(ctx, request) +// EnqueueMessage wraps QueueV2.EnqueueMessage. +func (_d faultInjectionQueueV2) EnqueueMessage(ctx context.Context, request *_sourcePersistence.InternalEnqueueMessageRequest) (ip1 *_sourcePersistence.InternalEnqueueMessageResponse, err error) { + err = _d.generator.generate("EnqueueMessage").inject(func() error { + ip1, err = _d.QueueV2.EnqueueMessage(ctx, request) + return err }) + return } -func (c *faultInjectionQueueV2) ListQueues( - ctx context.Context, - request *persistence.InternalListQueuesRequest, -) (*persistence.InternalListQueuesResponse, error) { - return inject1(c.generator.generate("ListQueues"), func() (*persistence.InternalListQueuesResponse, error) { - return c.baseStore.ListQueues(ctx, request) +// ListQueues wraps QueueV2.ListQueues. +func (_d faultInjectionQueueV2) ListQueues(ctx context.Context, request *_sourcePersistence.InternalListQueuesRequest) (ip1 *_sourcePersistence.InternalListQueuesResponse, err error) { + err = _d.generator.generate("ListQueues").inject(func() error { + ip1, err = _d.QueueV2.ListQueues(ctx, request) + return err }) + return } -func (c *faultInjectionQueueV2) RangeDeleteMessages( - ctx context.Context, - request *persistence.InternalRangeDeleteMessagesRequest, -) (*persistence.InternalRangeDeleteMessagesResponse, error) { - return inject1(c.generator.generate("RangeDeleteMessages"), func() (*persistence.InternalRangeDeleteMessagesResponse, error) { - return c.baseStore.RangeDeleteMessages(ctx, request) +// RangeDeleteMessages wraps QueueV2.RangeDeleteMessages. +func (_d faultInjectionQueueV2) RangeDeleteMessages(ctx context.Context, request *_sourcePersistence.InternalRangeDeleteMessagesRequest) (ip1 *_sourcePersistence.InternalRangeDeleteMessagesResponse, err error) { + err = _d.generator.generate("RangeDeleteMessages").inject(func() error { + ip1, err = _d.QueueV2.RangeDeleteMessages(ctx, request) + return err }) + return } -func (c *faultInjectionQueueV2) ReadMessages( - ctx context.Context, - request *persistence.InternalReadMessagesRequest, -) (*persistence.InternalReadMessagesResponse, error) { - return inject1(c.generator.generate("ReadMessages"), func() (*persistence.InternalReadMessagesResponse, error) { - return c.baseStore.ReadMessages(ctx, request) +// ReadMessages wraps QueueV2.ReadMessages. +func (_d faultInjectionQueueV2) ReadMessages(ctx context.Context, request *_sourcePersistence.InternalReadMessagesRequest) (ip1 *_sourcePersistence.InternalReadMessagesResponse, err error) { + err = _d.generator.generate("ReadMessages").inject(func() error { + ip1, err = _d.QueueV2.ReadMessages(ctx, request) + return err }) + return } diff --git a/common/persistence/faultinjection/shard_store_gen.go b/common/persistence/faultinjection/shard_store_gen.go index f4c749e00e4..7d7c588b461 100644 --- a/common/persistence/faultinjection/shard_store_gen.go +++ b/common/persistence/faultinjection/shard_store_gen.go @@ -22,68 +22,62 @@ // 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. +// Code generated by gowrap. DO NOT EDIT. +// template: gowrap_template +// gowrap: http://github.com/hexdigest/gowrap package faultinjection +//go:generate gowrap gen -p go.temporal.io/server/common/persistence -i ShardStore -t gowrap_template -o shard_store_gen.go -l "" + import ( "context" - "go.temporal.io/server/common/persistence" + _sourcePersistence "go.temporal.io/server/common/persistence" ) type ( + // faultInjectionShardStore implements ShardStore interface with fault injection. faultInjectionShardStore struct { - baseStore persistence.ShardStore + _sourcePersistence.ShardStore generator faultGenerator } ) +// newFaultInjectionShardStore returns faultInjectionShardStore. func newFaultInjectionShardStore( - baseStore persistence.ShardStore, + baseStore _sourcePersistence.ShardStore, generator faultGenerator, ) *faultInjectionShardStore { return &faultInjectionShardStore{ - baseStore: baseStore, - generator: generator, + ShardStore: baseStore, + generator: generator, } } -func (c *faultInjectionShardStore) AssertShardOwnership( - ctx context.Context, - request *persistence.AssertShardOwnershipRequest, -) error { - return inject0(c.generator.generate("AssertShardOwnership"), func() error { - return c.baseStore.AssertShardOwnership(ctx, request) +// AssertShardOwnership wraps ShardStore.AssertShardOwnership. +func (_d faultInjectionShardStore) AssertShardOwnership(ctx context.Context, request *_sourcePersistence.AssertShardOwnershipRequest) (err error) { + err = _d.generator.generate("AssertShardOwnership").inject(func() error { + err = _d.ShardStore.AssertShardOwnership(ctx, request) + return err }) + return } -func (c *faultInjectionShardStore) Close() { - c.baseStore.Close() -} - -func (c *faultInjectionShardStore) GetClusterName() string { - return c.baseStore.GetClusterName() -} - -func (c *faultInjectionShardStore) GetName() string { - return c.baseStore.GetName() -} - -func (c *faultInjectionShardStore) GetOrCreateShard( - ctx context.Context, - request *persistence.InternalGetOrCreateShardRequest, -) (*persistence.InternalGetOrCreateShardResponse, error) { - return inject1(c.generator.generate("GetOrCreateShard"), func() (*persistence.InternalGetOrCreateShardResponse, error) { - return c.baseStore.GetOrCreateShard(ctx, request) +// GetOrCreateShard wraps ShardStore.GetOrCreateShard. +func (_d faultInjectionShardStore) GetOrCreateShard(ctx context.Context, request *_sourcePersistence.InternalGetOrCreateShardRequest) (ip1 *_sourcePersistence.InternalGetOrCreateShardResponse, err error) { + err = _d.generator.generate("GetOrCreateShard").inject(func() error { + ip1, err = _d.ShardStore.GetOrCreateShard(ctx, request) + return err }) + return } -func (c *faultInjectionShardStore) UpdateShard( - ctx context.Context, - request *persistence.InternalUpdateShardRequest, -) error { - return inject0(c.generator.generate("UpdateShard"), func() error { - return c.baseStore.UpdateShard(ctx, request) +// UpdateShard wraps ShardStore.UpdateShard. +func (_d faultInjectionShardStore) UpdateShard(ctx context.Context, request *_sourcePersistence.InternalUpdateShardRequest) (err error) { + err = _d.generator.generate("UpdateShard").inject(func() error { + err = _d.ShardStore.UpdateShard(ctx, request) + return err }) + return } diff --git a/common/persistence/faultinjection/task_store_gen.go b/common/persistence/faultinjection/task_store_gen.go index 8b3121ab185..3eba62b6b7b 100644 --- a/common/persistence/faultinjection/task_store_gen.go +++ b/common/persistence/faultinjection/task_store_gen.go @@ -22,154 +22,152 @@ // 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. +// Code generated by gowrap. DO NOT EDIT. +// template: gowrap_template +// gowrap: http://github.com/hexdigest/gowrap package faultinjection +//go:generate gowrap gen -p go.temporal.io/server/common/persistence -i TaskStore -t gowrap_template -o task_store_gen.go -l "" + import ( "context" - "go.temporal.io/server/common/persistence" + _sourcePersistence "go.temporal.io/server/common/persistence" ) type ( + // faultInjectionTaskStore implements TaskStore interface with fault injection. faultInjectionTaskStore struct { - baseStore persistence.TaskStore + _sourcePersistence.TaskStore generator faultGenerator } ) +// newFaultInjectionTaskStore returns faultInjectionTaskStore. func newFaultInjectionTaskStore( - baseStore persistence.TaskStore, + baseStore _sourcePersistence.TaskStore, generator faultGenerator, ) *faultInjectionTaskStore { return &faultInjectionTaskStore{ - baseStore: baseStore, + TaskStore: baseStore, generator: generator, } } -func (c *faultInjectionTaskStore) Close() { - c.baseStore.Close() -} - -func (c *faultInjectionTaskStore) CompleteTasksLessThan( - ctx context.Context, - request *persistence.CompleteTasksLessThanRequest, -) (int, error) { - return inject1(c.generator.generate("CompleteTasksLessThan"), func() (int, error) { - return c.baseStore.CompleteTasksLessThan(ctx, request) +// CompleteTasksLessThan wraps TaskStore.CompleteTasksLessThan. +func (_d faultInjectionTaskStore) CompleteTasksLessThan(ctx context.Context, request *_sourcePersistence.CompleteTasksLessThanRequest) (i1 int, err error) { + err = _d.generator.generate("CompleteTasksLessThan").inject(func() error { + i1, err = _d.TaskStore.CompleteTasksLessThan(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) CountTaskQueuesByBuildId( - ctx context.Context, - request *persistence.CountTaskQueuesByBuildIdRequest, -) (int, error) { - return inject1(c.generator.generate("CountTaskQueuesByBuildId"), func() (int, error) { - return c.baseStore.CountTaskQueuesByBuildId(ctx, request) +// CountTaskQueuesByBuildId wraps TaskStore.CountTaskQueuesByBuildId. +func (_d faultInjectionTaskStore) CountTaskQueuesByBuildId(ctx context.Context, request *_sourcePersistence.CountTaskQueuesByBuildIdRequest) (i1 int, err error) { + err = _d.generator.generate("CountTaskQueuesByBuildId").inject(func() error { + i1, err = _d.TaskStore.CountTaskQueuesByBuildId(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) CreateTaskQueue( - ctx context.Context, - request *persistence.InternalCreateTaskQueueRequest, -) error { - return inject0(c.generator.generate("CreateTaskQueue"), func() error { - return c.baseStore.CreateTaskQueue(ctx, request) +// CreateTaskQueue wraps TaskStore.CreateTaskQueue. +func (_d faultInjectionTaskStore) CreateTaskQueue(ctx context.Context, request *_sourcePersistence.InternalCreateTaskQueueRequest) (err error) { + err = _d.generator.generate("CreateTaskQueue").inject(func() error { + err = _d.TaskStore.CreateTaskQueue(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) CreateTasks( - ctx context.Context, - request *persistence.InternalCreateTasksRequest, -) (*persistence.CreateTasksResponse, error) { - return inject1(c.generator.generate("CreateTasks"), func() (*persistence.CreateTasksResponse, error) { - return c.baseStore.CreateTasks(ctx, request) +// CreateTasks wraps TaskStore.CreateTasks. +func (_d faultInjectionTaskStore) CreateTasks(ctx context.Context, request *_sourcePersistence.InternalCreateTasksRequest) (cp1 *_sourcePersistence.CreateTasksResponse, err error) { + err = _d.generator.generate("CreateTasks").inject(func() error { + cp1, err = _d.TaskStore.CreateTasks(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) DeleteTaskQueue( - ctx context.Context, - request *persistence.DeleteTaskQueueRequest, -) error { - return inject0(c.generator.generate("DeleteTaskQueue"), func() error { - return c.baseStore.DeleteTaskQueue(ctx, request) +// DeleteTaskQueue wraps TaskStore.DeleteTaskQueue. +func (_d faultInjectionTaskStore) DeleteTaskQueue(ctx context.Context, request *_sourcePersistence.DeleteTaskQueueRequest) (err error) { + err = _d.generator.generate("DeleteTaskQueue").inject(func() error { + err = _d.TaskStore.DeleteTaskQueue(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) GetName() string { - return c.baseStore.GetName() -} - -func (c *faultInjectionTaskStore) GetTaskQueue( - ctx context.Context, - request *persistence.InternalGetTaskQueueRequest, -) (*persistence.InternalGetTaskQueueResponse, error) { - return inject1(c.generator.generate("GetTaskQueue"), func() (*persistence.InternalGetTaskQueueResponse, error) { - return c.baseStore.GetTaskQueue(ctx, request) +// GetTaskQueue wraps TaskStore.GetTaskQueue. +func (_d faultInjectionTaskStore) GetTaskQueue(ctx context.Context, request *_sourcePersistence.InternalGetTaskQueueRequest) (ip1 *_sourcePersistence.InternalGetTaskQueueResponse, err error) { + err = _d.generator.generate("GetTaskQueue").inject(func() error { + ip1, err = _d.TaskStore.GetTaskQueue(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) GetTaskQueueUserData( - ctx context.Context, - request *persistence.GetTaskQueueUserDataRequest, -) (*persistence.InternalGetTaskQueueUserDataResponse, error) { - return inject1(c.generator.generate("GetTaskQueueUserData"), func() (*persistence.InternalGetTaskQueueUserDataResponse, error) { - return c.baseStore.GetTaskQueueUserData(ctx, request) +// GetTaskQueueUserData wraps TaskStore.GetTaskQueueUserData. +func (_d faultInjectionTaskStore) GetTaskQueueUserData(ctx context.Context, request *_sourcePersistence.GetTaskQueueUserDataRequest) (ip1 *_sourcePersistence.InternalGetTaskQueueUserDataResponse, err error) { + err = _d.generator.generate("GetTaskQueueUserData").inject(func() error { + ip1, err = _d.TaskStore.GetTaskQueueUserData(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) GetTaskQueuesByBuildId( - ctx context.Context, - request *persistence.GetTaskQueuesByBuildIdRequest, -) ([]string, error) { - return inject1(c.generator.generate("GetTaskQueuesByBuildId"), func() ([]string, error) { - return c.baseStore.GetTaskQueuesByBuildId(ctx, request) +// GetTaskQueuesByBuildId wraps TaskStore.GetTaskQueuesByBuildId. +func (_d faultInjectionTaskStore) GetTaskQueuesByBuildId(ctx context.Context, request *_sourcePersistence.GetTaskQueuesByBuildIdRequest) (sa1 []string, err error) { + err = _d.generator.generate("GetTaskQueuesByBuildId").inject(func() error { + sa1, err = _d.TaskStore.GetTaskQueuesByBuildId(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) GetTasks( - ctx context.Context, - request *persistence.GetTasksRequest, -) (*persistence.InternalGetTasksResponse, error) { - return inject1(c.generator.generate("GetTasks"), func() (*persistence.InternalGetTasksResponse, error) { - return c.baseStore.GetTasks(ctx, request) +// GetTasks wraps TaskStore.GetTasks. +func (_d faultInjectionTaskStore) GetTasks(ctx context.Context, request *_sourcePersistence.GetTasksRequest) (ip1 *_sourcePersistence.InternalGetTasksResponse, err error) { + err = _d.generator.generate("GetTasks").inject(func() error { + ip1, err = _d.TaskStore.GetTasks(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) ListTaskQueue( - ctx context.Context, - request *persistence.ListTaskQueueRequest, -) (*persistence.InternalListTaskQueueResponse, error) { - return inject1(c.generator.generate("ListTaskQueue"), func() (*persistence.InternalListTaskQueueResponse, error) { - return c.baseStore.ListTaskQueue(ctx, request) +// ListTaskQueue wraps TaskStore.ListTaskQueue. +func (_d faultInjectionTaskStore) ListTaskQueue(ctx context.Context, request *_sourcePersistence.ListTaskQueueRequest) (ip1 *_sourcePersistence.InternalListTaskQueueResponse, err error) { + err = _d.generator.generate("ListTaskQueue").inject(func() error { + ip1, err = _d.TaskStore.ListTaskQueue(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) ListTaskQueueUserDataEntries( - ctx context.Context, - request *persistence.ListTaskQueueUserDataEntriesRequest, -) (*persistence.InternalListTaskQueueUserDataEntriesResponse, error) { - return inject1(c.generator.generate("ListTaskQueueUserDataEntries"), func() (*persistence.InternalListTaskQueueUserDataEntriesResponse, error) { - return c.baseStore.ListTaskQueueUserDataEntries(ctx, request) +// ListTaskQueueUserDataEntries wraps TaskStore.ListTaskQueueUserDataEntries. +func (_d faultInjectionTaskStore) ListTaskQueueUserDataEntries(ctx context.Context, request *_sourcePersistence.ListTaskQueueUserDataEntriesRequest) (ip1 *_sourcePersistence.InternalListTaskQueueUserDataEntriesResponse, err error) { + err = _d.generator.generate("ListTaskQueueUserDataEntries").inject(func() error { + ip1, err = _d.TaskStore.ListTaskQueueUserDataEntries(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) UpdateTaskQueue( - ctx context.Context, - request *persistence.InternalUpdateTaskQueueRequest, -) (*persistence.UpdateTaskQueueResponse, error) { - return inject1(c.generator.generate("UpdateTaskQueue"), func() (*persistence.UpdateTaskQueueResponse, error) { - return c.baseStore.UpdateTaskQueue(ctx, request) +// UpdateTaskQueue wraps TaskStore.UpdateTaskQueue. +func (_d faultInjectionTaskStore) UpdateTaskQueue(ctx context.Context, request *_sourcePersistence.InternalUpdateTaskQueueRequest) (up1 *_sourcePersistence.UpdateTaskQueueResponse, err error) { + err = _d.generator.generate("UpdateTaskQueue").inject(func() error { + up1, err = _d.TaskStore.UpdateTaskQueue(ctx, request) + return err }) + return } -func (c *faultInjectionTaskStore) UpdateTaskQueueUserData( - ctx context.Context, - request *persistence.InternalUpdateTaskQueueUserDataRequest, -) error { - return inject0(c.generator.generate("UpdateTaskQueueUserData"), func() error { - return c.baseStore.UpdateTaskQueueUserData(ctx, request) +// UpdateTaskQueueUserData wraps TaskStore.UpdateTaskQueueUserData. +func (_d faultInjectionTaskStore) UpdateTaskQueueUserData(ctx context.Context, request *_sourcePersistence.InternalUpdateTaskQueueUserDataRequest) (err error) { + err = _d.generator.generate("UpdateTaskQueueUserData").inject(func() error { + err = _d.TaskStore.UpdateTaskQueueUserData(ctx, request) + return err }) + return } diff --git a/common/persistence/persistence_interface.go b/common/persistence/persistence_interface.go index 57eae2725d8..348f8e6c55d 100644 --- a/common/persistence/persistence_interface.go +++ b/common/persistence/persistence_interface.go @@ -24,9 +24,6 @@ //go:generate mockgen -copyright_file ../../LICENSE -package mock -source $GOFILE -destination mock/store_mock.go -aux_files go.temporal.io/server/common/persistence=data_interfaces.go -// Generates fault injection stores. -//go:generate go run ../../cmd/tools/genfaultinjection -copyright_file ../../LICENSE -out faultinjection - package persistence import ( From 027144dbcb44576b2b8c5b6fd0d21ad5a79f7bd4 Mon Sep 17 00:00:00 2001 From: Stephan Behnke Date: Thu, 9 Jan 2025 08:32:07 -0800 Subject: [PATCH 2/2] remove _ from receiver --- .../cluster_metadata_store_gen.go | 42 ++--- .../faultinjection/execution_store_gen.go | 150 +++++++++--------- .../faultinjection/gowrap_template | 6 +- .../faultinjection/metadata_store_gen.go | 42 ++--- .../nexus_endpoint_store_gen.go | 24 +-- .../persistence/faultinjection/queue_gen.go | 60 +++---- .../faultinjection/queue_v2_gen.go | 30 ++-- .../faultinjection/shard_store_gen.go | 18 +-- .../faultinjection/task_store_gen.go | 78 ++++----- 9 files changed, 225 insertions(+), 225 deletions(-) diff --git a/common/persistence/faultinjection/cluster_metadata_store_gen.go b/common/persistence/faultinjection/cluster_metadata_store_gen.go index 151292da087..1b2119a3239 100644 --- a/common/persistence/faultinjection/cluster_metadata_store_gen.go +++ b/common/persistence/faultinjection/cluster_metadata_store_gen.go @@ -56,63 +56,63 @@ func newFaultInjectionClusterMetadataStore( } // DeleteClusterMetadata wraps ClusterMetadataStore.DeleteClusterMetadata. -func (_d faultInjectionClusterMetadataStore) DeleteClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalDeleteClusterMetadataRequest) (err error) { - err = _d.generator.generate("DeleteClusterMetadata").inject(func() error { - err = _d.ClusterMetadataStore.DeleteClusterMetadata(ctx, request) +func (d faultInjectionClusterMetadataStore) DeleteClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalDeleteClusterMetadataRequest) (err error) { + err = d.generator.generate("DeleteClusterMetadata").inject(func() error { + err = d.ClusterMetadataStore.DeleteClusterMetadata(ctx, request) return err }) return } // GetClusterMembers wraps ClusterMetadataStore.GetClusterMembers. -func (_d faultInjectionClusterMetadataStore) GetClusterMembers(ctx context.Context, request *_sourcePersistence.GetClusterMembersRequest) (gp1 *_sourcePersistence.GetClusterMembersResponse, err error) { - err = _d.generator.generate("GetClusterMembers").inject(func() error { - gp1, err = _d.ClusterMetadataStore.GetClusterMembers(ctx, request) +func (d faultInjectionClusterMetadataStore) GetClusterMembers(ctx context.Context, request *_sourcePersistence.GetClusterMembersRequest) (gp1 *_sourcePersistence.GetClusterMembersResponse, err error) { + err = d.generator.generate("GetClusterMembers").inject(func() error { + gp1, err = d.ClusterMetadataStore.GetClusterMembers(ctx, request) return err }) return } // GetClusterMetadata wraps ClusterMetadataStore.GetClusterMetadata. -func (_d faultInjectionClusterMetadataStore) GetClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalGetClusterMetadataRequest) (ip1 *_sourcePersistence.InternalGetClusterMetadataResponse, err error) { - err = _d.generator.generate("GetClusterMetadata").inject(func() error { - ip1, err = _d.ClusterMetadataStore.GetClusterMetadata(ctx, request) +func (d faultInjectionClusterMetadataStore) GetClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalGetClusterMetadataRequest) (ip1 *_sourcePersistence.InternalGetClusterMetadataResponse, err error) { + err = d.generator.generate("GetClusterMetadata").inject(func() error { + ip1, err = d.ClusterMetadataStore.GetClusterMetadata(ctx, request) return err }) return } // ListClusterMetadata wraps ClusterMetadataStore.ListClusterMetadata. -func (_d faultInjectionClusterMetadataStore) ListClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalListClusterMetadataRequest) (ip1 *_sourcePersistence.InternalListClusterMetadataResponse, err error) { - err = _d.generator.generate("ListClusterMetadata").inject(func() error { - ip1, err = _d.ClusterMetadataStore.ListClusterMetadata(ctx, request) +func (d faultInjectionClusterMetadataStore) ListClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalListClusterMetadataRequest) (ip1 *_sourcePersistence.InternalListClusterMetadataResponse, err error) { + err = d.generator.generate("ListClusterMetadata").inject(func() error { + ip1, err = d.ClusterMetadataStore.ListClusterMetadata(ctx, request) return err }) return } // PruneClusterMembership wraps ClusterMetadataStore.PruneClusterMembership. -func (_d faultInjectionClusterMetadataStore) PruneClusterMembership(ctx context.Context, request *_sourcePersistence.PruneClusterMembershipRequest) (err error) { - err = _d.generator.generate("PruneClusterMembership").inject(func() error { - err = _d.ClusterMetadataStore.PruneClusterMembership(ctx, request) +func (d faultInjectionClusterMetadataStore) PruneClusterMembership(ctx context.Context, request *_sourcePersistence.PruneClusterMembershipRequest) (err error) { + err = d.generator.generate("PruneClusterMembership").inject(func() error { + err = d.ClusterMetadataStore.PruneClusterMembership(ctx, request) return err }) return } // SaveClusterMetadata wraps ClusterMetadataStore.SaveClusterMetadata. -func (_d faultInjectionClusterMetadataStore) SaveClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalSaveClusterMetadataRequest) (b1 bool, err error) { - err = _d.generator.generate("SaveClusterMetadata").inject(func() error { - b1, err = _d.ClusterMetadataStore.SaveClusterMetadata(ctx, request) +func (d faultInjectionClusterMetadataStore) SaveClusterMetadata(ctx context.Context, request *_sourcePersistence.InternalSaveClusterMetadataRequest) (b1 bool, err error) { + err = d.generator.generate("SaveClusterMetadata").inject(func() error { + b1, err = d.ClusterMetadataStore.SaveClusterMetadata(ctx, request) return err }) return } // UpsertClusterMembership wraps ClusterMetadataStore.UpsertClusterMembership. -func (_d faultInjectionClusterMetadataStore) UpsertClusterMembership(ctx context.Context, request *_sourcePersistence.UpsertClusterMembershipRequest) (err error) { - err = _d.generator.generate("UpsertClusterMembership").inject(func() error { - err = _d.ClusterMetadataStore.UpsertClusterMembership(ctx, request) +func (d faultInjectionClusterMetadataStore) UpsertClusterMembership(ctx context.Context, request *_sourcePersistence.UpsertClusterMembershipRequest) (err error) { + err = d.generator.generate("UpsertClusterMembership").inject(func() error { + err = d.ClusterMetadataStore.UpsertClusterMembership(ctx, request) return err }) return diff --git a/common/persistence/faultinjection/execution_store_gen.go b/common/persistence/faultinjection/execution_store_gen.go index 8cd2e962e3c..c8b546e8f37 100644 --- a/common/persistence/faultinjection/execution_store_gen.go +++ b/common/persistence/faultinjection/execution_store_gen.go @@ -56,225 +56,225 @@ func newFaultInjectionExecutionStore( } // AddHistoryTasks wraps ExecutionStore.AddHistoryTasks. -func (_d faultInjectionExecutionStore) AddHistoryTasks(ctx context.Context, request *_sourcePersistence.InternalAddHistoryTasksRequest) (err error) { - err = _d.generator.generate("AddHistoryTasks").inject(func() error { - err = _d.ExecutionStore.AddHistoryTasks(ctx, request) +func (d faultInjectionExecutionStore) AddHistoryTasks(ctx context.Context, request *_sourcePersistence.InternalAddHistoryTasksRequest) (err error) { + err = d.generator.generate("AddHistoryTasks").inject(func() error { + err = d.ExecutionStore.AddHistoryTasks(ctx, request) return err }) return } // AppendHistoryNodes wraps ExecutionStore.AppendHistoryNodes. -func (_d faultInjectionExecutionStore) AppendHistoryNodes(ctx context.Context, request *_sourcePersistence.InternalAppendHistoryNodesRequest) (err error) { - err = _d.generator.generate("AppendHistoryNodes").inject(func() error { - err = _d.ExecutionStore.AppendHistoryNodes(ctx, request) +func (d faultInjectionExecutionStore) AppendHistoryNodes(ctx context.Context, request *_sourcePersistence.InternalAppendHistoryNodesRequest) (err error) { + err = d.generator.generate("AppendHistoryNodes").inject(func() error { + err = d.ExecutionStore.AppendHistoryNodes(ctx, request) return err }) return } // CompleteHistoryTask wraps ExecutionStore.CompleteHistoryTask. -func (_d faultInjectionExecutionStore) CompleteHistoryTask(ctx context.Context, request *_sourcePersistence.CompleteHistoryTaskRequest) (err error) { - err = _d.generator.generate("CompleteHistoryTask").inject(func() error { - err = _d.ExecutionStore.CompleteHistoryTask(ctx, request) +func (d faultInjectionExecutionStore) CompleteHistoryTask(ctx context.Context, request *_sourcePersistence.CompleteHistoryTaskRequest) (err error) { + err = d.generator.generate("CompleteHistoryTask").inject(func() error { + err = d.ExecutionStore.CompleteHistoryTask(ctx, request) return err }) return } // ConflictResolveWorkflowExecution wraps ExecutionStore.ConflictResolveWorkflowExecution. -func (_d faultInjectionExecutionStore) ConflictResolveWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalConflictResolveWorkflowExecutionRequest) (err error) { - err = _d.generator.generate("ConflictResolveWorkflowExecution").inject(func() error { - err = _d.ExecutionStore.ConflictResolveWorkflowExecution(ctx, request) +func (d faultInjectionExecutionStore) ConflictResolveWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalConflictResolveWorkflowExecutionRequest) (err error) { + err = d.generator.generate("ConflictResolveWorkflowExecution").inject(func() error { + err = d.ExecutionStore.ConflictResolveWorkflowExecution(ctx, request) return err }) return } // CreateWorkflowExecution wraps ExecutionStore.CreateWorkflowExecution. -func (_d faultInjectionExecutionStore) CreateWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalCreateWorkflowExecutionRequest) (ip1 *_sourcePersistence.InternalCreateWorkflowExecutionResponse, err error) { - err = _d.generator.generate("CreateWorkflowExecution").inject(func() error { - ip1, err = _d.ExecutionStore.CreateWorkflowExecution(ctx, request) +func (d faultInjectionExecutionStore) CreateWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalCreateWorkflowExecutionRequest) (ip1 *_sourcePersistence.InternalCreateWorkflowExecutionResponse, err error) { + err = d.generator.generate("CreateWorkflowExecution").inject(func() error { + ip1, err = d.ExecutionStore.CreateWorkflowExecution(ctx, request) return err }) return } // DeleteCurrentWorkflowExecution wraps ExecutionStore.DeleteCurrentWorkflowExecution. -func (_d faultInjectionExecutionStore) DeleteCurrentWorkflowExecution(ctx context.Context, request *_sourcePersistence.DeleteCurrentWorkflowExecutionRequest) (err error) { - err = _d.generator.generate("DeleteCurrentWorkflowExecution").inject(func() error { - err = _d.ExecutionStore.DeleteCurrentWorkflowExecution(ctx, request) +func (d faultInjectionExecutionStore) DeleteCurrentWorkflowExecution(ctx context.Context, request *_sourcePersistence.DeleteCurrentWorkflowExecutionRequest) (err error) { + err = d.generator.generate("DeleteCurrentWorkflowExecution").inject(func() error { + err = d.ExecutionStore.DeleteCurrentWorkflowExecution(ctx, request) return err }) return } // DeleteHistoryBranch wraps ExecutionStore.DeleteHistoryBranch. -func (_d faultInjectionExecutionStore) DeleteHistoryBranch(ctx context.Context, request *_sourcePersistence.InternalDeleteHistoryBranchRequest) (err error) { - err = _d.generator.generate("DeleteHistoryBranch").inject(func() error { - err = _d.ExecutionStore.DeleteHistoryBranch(ctx, request) +func (d faultInjectionExecutionStore) DeleteHistoryBranch(ctx context.Context, request *_sourcePersistence.InternalDeleteHistoryBranchRequest) (err error) { + err = d.generator.generate("DeleteHistoryBranch").inject(func() error { + err = d.ExecutionStore.DeleteHistoryBranch(ctx, request) return err }) return } // DeleteHistoryNodes wraps ExecutionStore.DeleteHistoryNodes. -func (_d faultInjectionExecutionStore) DeleteHistoryNodes(ctx context.Context, request *_sourcePersistence.InternalDeleteHistoryNodesRequest) (err error) { - err = _d.generator.generate("DeleteHistoryNodes").inject(func() error { - err = _d.ExecutionStore.DeleteHistoryNodes(ctx, request) +func (d faultInjectionExecutionStore) DeleteHistoryNodes(ctx context.Context, request *_sourcePersistence.InternalDeleteHistoryNodesRequest) (err error) { + err = d.generator.generate("DeleteHistoryNodes").inject(func() error { + err = d.ExecutionStore.DeleteHistoryNodes(ctx, request) return err }) return } // DeleteReplicationTaskFromDLQ wraps ExecutionStore.DeleteReplicationTaskFromDLQ. -func (_d faultInjectionExecutionStore) DeleteReplicationTaskFromDLQ(ctx context.Context, request *_sourcePersistence.DeleteReplicationTaskFromDLQRequest) (err error) { - err = _d.generator.generate("DeleteReplicationTaskFromDLQ").inject(func() error { - err = _d.ExecutionStore.DeleteReplicationTaskFromDLQ(ctx, request) +func (d faultInjectionExecutionStore) DeleteReplicationTaskFromDLQ(ctx context.Context, request *_sourcePersistence.DeleteReplicationTaskFromDLQRequest) (err error) { + err = d.generator.generate("DeleteReplicationTaskFromDLQ").inject(func() error { + err = d.ExecutionStore.DeleteReplicationTaskFromDLQ(ctx, request) return err }) return } // DeleteWorkflowExecution wraps ExecutionStore.DeleteWorkflowExecution. -func (_d faultInjectionExecutionStore) DeleteWorkflowExecution(ctx context.Context, request *_sourcePersistence.DeleteWorkflowExecutionRequest) (err error) { - err = _d.generator.generate("DeleteWorkflowExecution").inject(func() error { - err = _d.ExecutionStore.DeleteWorkflowExecution(ctx, request) +func (d faultInjectionExecutionStore) DeleteWorkflowExecution(ctx context.Context, request *_sourcePersistence.DeleteWorkflowExecutionRequest) (err error) { + err = d.generator.generate("DeleteWorkflowExecution").inject(func() error { + err = d.ExecutionStore.DeleteWorkflowExecution(ctx, request) return err }) return } // ForkHistoryBranch wraps ExecutionStore.ForkHistoryBranch. -func (_d faultInjectionExecutionStore) ForkHistoryBranch(ctx context.Context, request *_sourcePersistence.InternalForkHistoryBranchRequest) (err error) { - err = _d.generator.generate("ForkHistoryBranch").inject(func() error { - err = _d.ExecutionStore.ForkHistoryBranch(ctx, request) +func (d faultInjectionExecutionStore) ForkHistoryBranch(ctx context.Context, request *_sourcePersistence.InternalForkHistoryBranchRequest) (err error) { + err = d.generator.generate("ForkHistoryBranch").inject(func() error { + err = d.ExecutionStore.ForkHistoryBranch(ctx, request) return err }) return } // GetAllHistoryTreeBranches wraps ExecutionStore.GetAllHistoryTreeBranches. -func (_d faultInjectionExecutionStore) GetAllHistoryTreeBranches(ctx context.Context, request *_sourcePersistence.GetAllHistoryTreeBranchesRequest) (ip1 *_sourcePersistence.InternalGetAllHistoryTreeBranchesResponse, err error) { - err = _d.generator.generate("GetAllHistoryTreeBranches").inject(func() error { - ip1, err = _d.ExecutionStore.GetAllHistoryTreeBranches(ctx, request) +func (d faultInjectionExecutionStore) GetAllHistoryTreeBranches(ctx context.Context, request *_sourcePersistence.GetAllHistoryTreeBranchesRequest) (ip1 *_sourcePersistence.InternalGetAllHistoryTreeBranchesResponse, err error) { + err = d.generator.generate("GetAllHistoryTreeBranches").inject(func() error { + ip1, err = d.ExecutionStore.GetAllHistoryTreeBranches(ctx, request) return err }) return } // GetCurrentExecution wraps ExecutionStore.GetCurrentExecution. -func (_d faultInjectionExecutionStore) GetCurrentExecution(ctx context.Context, request *_sourcePersistence.GetCurrentExecutionRequest) (ip1 *_sourcePersistence.InternalGetCurrentExecutionResponse, err error) { - err = _d.generator.generate("GetCurrentExecution").inject(func() error { - ip1, err = _d.ExecutionStore.GetCurrentExecution(ctx, request) +func (d faultInjectionExecutionStore) GetCurrentExecution(ctx context.Context, request *_sourcePersistence.GetCurrentExecutionRequest) (ip1 *_sourcePersistence.InternalGetCurrentExecutionResponse, err error) { + err = d.generator.generate("GetCurrentExecution").inject(func() error { + ip1, err = d.ExecutionStore.GetCurrentExecution(ctx, request) return err }) return } // GetHistoryTasks wraps ExecutionStore.GetHistoryTasks. -func (_d faultInjectionExecutionStore) GetHistoryTasks(ctx context.Context, request *_sourcePersistence.GetHistoryTasksRequest) (ip1 *_sourcePersistence.InternalGetHistoryTasksResponse, err error) { - err = _d.generator.generate("GetHistoryTasks").inject(func() error { - ip1, err = _d.ExecutionStore.GetHistoryTasks(ctx, request) +func (d faultInjectionExecutionStore) GetHistoryTasks(ctx context.Context, request *_sourcePersistence.GetHistoryTasksRequest) (ip1 *_sourcePersistence.InternalGetHistoryTasksResponse, err error) { + err = d.generator.generate("GetHistoryTasks").inject(func() error { + ip1, err = d.ExecutionStore.GetHistoryTasks(ctx, request) return err }) return } // GetHistoryTreeContainingBranch wraps ExecutionStore.GetHistoryTreeContainingBranch. -func (_d faultInjectionExecutionStore) GetHistoryTreeContainingBranch(ctx context.Context, request *_sourcePersistence.InternalGetHistoryTreeContainingBranchRequest) (ip1 *_sourcePersistence.InternalGetHistoryTreeContainingBranchResponse, err error) { - err = _d.generator.generate("GetHistoryTreeContainingBranch").inject(func() error { - ip1, err = _d.ExecutionStore.GetHistoryTreeContainingBranch(ctx, request) +func (d faultInjectionExecutionStore) GetHistoryTreeContainingBranch(ctx context.Context, request *_sourcePersistence.InternalGetHistoryTreeContainingBranchRequest) (ip1 *_sourcePersistence.InternalGetHistoryTreeContainingBranchResponse, err error) { + err = d.generator.generate("GetHistoryTreeContainingBranch").inject(func() error { + ip1, err = d.ExecutionStore.GetHistoryTreeContainingBranch(ctx, request) return err }) return } // GetReplicationTasksFromDLQ wraps ExecutionStore.GetReplicationTasksFromDLQ. -func (_d faultInjectionExecutionStore) GetReplicationTasksFromDLQ(ctx context.Context, request *_sourcePersistence.GetReplicationTasksFromDLQRequest) (ip1 *_sourcePersistence.InternalGetReplicationTasksFromDLQResponse, err error) { - err = _d.generator.generate("GetReplicationTasksFromDLQ").inject(func() error { - ip1, err = _d.ExecutionStore.GetReplicationTasksFromDLQ(ctx, request) +func (d faultInjectionExecutionStore) GetReplicationTasksFromDLQ(ctx context.Context, request *_sourcePersistence.GetReplicationTasksFromDLQRequest) (ip1 *_sourcePersistence.InternalGetReplicationTasksFromDLQResponse, err error) { + err = d.generator.generate("GetReplicationTasksFromDLQ").inject(func() error { + ip1, err = d.ExecutionStore.GetReplicationTasksFromDLQ(ctx, request) return err }) return } // GetWorkflowExecution wraps ExecutionStore.GetWorkflowExecution. -func (_d faultInjectionExecutionStore) GetWorkflowExecution(ctx context.Context, request *_sourcePersistence.GetWorkflowExecutionRequest) (ip1 *_sourcePersistence.InternalGetWorkflowExecutionResponse, err error) { - err = _d.generator.generate("GetWorkflowExecution").inject(func() error { - ip1, err = _d.ExecutionStore.GetWorkflowExecution(ctx, request) +func (d faultInjectionExecutionStore) GetWorkflowExecution(ctx context.Context, request *_sourcePersistence.GetWorkflowExecutionRequest) (ip1 *_sourcePersistence.InternalGetWorkflowExecutionResponse, err error) { + err = d.generator.generate("GetWorkflowExecution").inject(func() error { + ip1, err = d.ExecutionStore.GetWorkflowExecution(ctx, request) return err }) return } // IsReplicationDLQEmpty wraps ExecutionStore.IsReplicationDLQEmpty. -func (_d faultInjectionExecutionStore) IsReplicationDLQEmpty(ctx context.Context, request *_sourcePersistence.GetReplicationTasksFromDLQRequest) (b1 bool, err error) { - err = _d.generator.generate("IsReplicationDLQEmpty").inject(func() error { - b1, err = _d.ExecutionStore.IsReplicationDLQEmpty(ctx, request) +func (d faultInjectionExecutionStore) IsReplicationDLQEmpty(ctx context.Context, request *_sourcePersistence.GetReplicationTasksFromDLQRequest) (b1 bool, err error) { + err = d.generator.generate("IsReplicationDLQEmpty").inject(func() error { + b1, err = d.ExecutionStore.IsReplicationDLQEmpty(ctx, request) return err }) return } // ListConcreteExecutions wraps ExecutionStore.ListConcreteExecutions. -func (_d faultInjectionExecutionStore) ListConcreteExecutions(ctx context.Context, request *_sourcePersistence.ListConcreteExecutionsRequest) (ip1 *_sourcePersistence.InternalListConcreteExecutionsResponse, err error) { - err = _d.generator.generate("ListConcreteExecutions").inject(func() error { - ip1, err = _d.ExecutionStore.ListConcreteExecutions(ctx, request) +func (d faultInjectionExecutionStore) ListConcreteExecutions(ctx context.Context, request *_sourcePersistence.ListConcreteExecutionsRequest) (ip1 *_sourcePersistence.InternalListConcreteExecutionsResponse, err error) { + err = d.generator.generate("ListConcreteExecutions").inject(func() error { + ip1, err = d.ExecutionStore.ListConcreteExecutions(ctx, request) return err }) return } // PutReplicationTaskToDLQ wraps ExecutionStore.PutReplicationTaskToDLQ. -func (_d faultInjectionExecutionStore) PutReplicationTaskToDLQ(ctx context.Context, request *_sourcePersistence.PutReplicationTaskToDLQRequest) (err error) { - err = _d.generator.generate("PutReplicationTaskToDLQ").inject(func() error { - err = _d.ExecutionStore.PutReplicationTaskToDLQ(ctx, request) +func (d faultInjectionExecutionStore) PutReplicationTaskToDLQ(ctx context.Context, request *_sourcePersistence.PutReplicationTaskToDLQRequest) (err error) { + err = d.generator.generate("PutReplicationTaskToDLQ").inject(func() error { + err = d.ExecutionStore.PutReplicationTaskToDLQ(ctx, request) return err }) return } // RangeCompleteHistoryTasks wraps ExecutionStore.RangeCompleteHistoryTasks. -func (_d faultInjectionExecutionStore) RangeCompleteHistoryTasks(ctx context.Context, request *_sourcePersistence.RangeCompleteHistoryTasksRequest) (err error) { - err = _d.generator.generate("RangeCompleteHistoryTasks").inject(func() error { - err = _d.ExecutionStore.RangeCompleteHistoryTasks(ctx, request) +func (d faultInjectionExecutionStore) RangeCompleteHistoryTasks(ctx context.Context, request *_sourcePersistence.RangeCompleteHistoryTasksRequest) (err error) { + err = d.generator.generate("RangeCompleteHistoryTasks").inject(func() error { + err = d.ExecutionStore.RangeCompleteHistoryTasks(ctx, request) return err }) return } // RangeDeleteReplicationTaskFromDLQ wraps ExecutionStore.RangeDeleteReplicationTaskFromDLQ. -func (_d faultInjectionExecutionStore) RangeDeleteReplicationTaskFromDLQ(ctx context.Context, request *_sourcePersistence.RangeDeleteReplicationTaskFromDLQRequest) (err error) { - err = _d.generator.generate("RangeDeleteReplicationTaskFromDLQ").inject(func() error { - err = _d.ExecutionStore.RangeDeleteReplicationTaskFromDLQ(ctx, request) +func (d faultInjectionExecutionStore) RangeDeleteReplicationTaskFromDLQ(ctx context.Context, request *_sourcePersistence.RangeDeleteReplicationTaskFromDLQRequest) (err error) { + err = d.generator.generate("RangeDeleteReplicationTaskFromDLQ").inject(func() error { + err = d.ExecutionStore.RangeDeleteReplicationTaskFromDLQ(ctx, request) return err }) return } // ReadHistoryBranch wraps ExecutionStore.ReadHistoryBranch. -func (_d faultInjectionExecutionStore) ReadHistoryBranch(ctx context.Context, request *_sourcePersistence.InternalReadHistoryBranchRequest) (ip1 *_sourcePersistence.InternalReadHistoryBranchResponse, err error) { - err = _d.generator.generate("ReadHistoryBranch").inject(func() error { - ip1, err = _d.ExecutionStore.ReadHistoryBranch(ctx, request) +func (d faultInjectionExecutionStore) ReadHistoryBranch(ctx context.Context, request *_sourcePersistence.InternalReadHistoryBranchRequest) (ip1 *_sourcePersistence.InternalReadHistoryBranchResponse, err error) { + err = d.generator.generate("ReadHistoryBranch").inject(func() error { + ip1, err = d.ExecutionStore.ReadHistoryBranch(ctx, request) return err }) return } // SetWorkflowExecution wraps ExecutionStore.SetWorkflowExecution. -func (_d faultInjectionExecutionStore) SetWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalSetWorkflowExecutionRequest) (err error) { - err = _d.generator.generate("SetWorkflowExecution").inject(func() error { - err = _d.ExecutionStore.SetWorkflowExecution(ctx, request) +func (d faultInjectionExecutionStore) SetWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalSetWorkflowExecutionRequest) (err error) { + err = d.generator.generate("SetWorkflowExecution").inject(func() error { + err = d.ExecutionStore.SetWorkflowExecution(ctx, request) return err }) return } // UpdateWorkflowExecution wraps ExecutionStore.UpdateWorkflowExecution. -func (_d faultInjectionExecutionStore) UpdateWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalUpdateWorkflowExecutionRequest) (err error) { - err = _d.generator.generate("UpdateWorkflowExecution").inject(func() error { - err = _d.ExecutionStore.UpdateWorkflowExecution(ctx, request) +func (d faultInjectionExecutionStore) UpdateWorkflowExecution(ctx context.Context, request *_sourcePersistence.InternalUpdateWorkflowExecutionRequest) (err error) { + err = d.generator.generate("UpdateWorkflowExecution").inject(func() error { + err = d.ExecutionStore.UpdateWorkflowExecution(ctx, request) return err }) return diff --git a/common/persistence/faultinjection/gowrap_template b/common/persistence/faultinjection/gowrap_template index f19daf4202f..aabd55c9d48 100644 --- a/common/persistence/faultinjection/gowrap_template +++ b/common/persistence/faultinjection/gowrap_template @@ -23,9 +23,9 @@ func new{{upFirst $decorator}} ( {{if (and $method.AcceptsContext (gt (len $method.Params) 1)) }} {{ $methodIdent := (printf "%s.%s" $.Interface.Name $method.Name) }} // {{$method.Name}} wraps {{ (printf "%s.%s" $.Interface.Name $method.Name) }}. - func (_d {{$decorator}}) {{$method.Declaration}} { - err = _d.generator.generate("{{ $method.Name }}").inject(func() error { - {{$method.ResultsNames}} = _d.{{$.Interface.Name}}.{{$method.Call}} + func (d {{$decorator}}) {{$method.Declaration}} { + err = d.generator.generate("{{ $method.Name }}").inject(func() error { + {{$method.ResultsNames}} = d.{{$.Interface.Name}}.{{$method.Call}} return err }) return diff --git a/common/persistence/faultinjection/metadata_store_gen.go b/common/persistence/faultinjection/metadata_store_gen.go index d7cb4acdd96..2cb6d29723e 100644 --- a/common/persistence/faultinjection/metadata_store_gen.go +++ b/common/persistence/faultinjection/metadata_store_gen.go @@ -56,63 +56,63 @@ func newFaultInjectionMetadataStore( } // CreateNamespace wraps MetadataStore.CreateNamespace. -func (_d faultInjectionMetadataStore) CreateNamespace(ctx context.Context, request *_sourcePersistence.InternalCreateNamespaceRequest) (cp1 *_sourcePersistence.CreateNamespaceResponse, err error) { - err = _d.generator.generate("CreateNamespace").inject(func() error { - cp1, err = _d.MetadataStore.CreateNamespace(ctx, request) +func (d faultInjectionMetadataStore) CreateNamespace(ctx context.Context, request *_sourcePersistence.InternalCreateNamespaceRequest) (cp1 *_sourcePersistence.CreateNamespaceResponse, err error) { + err = d.generator.generate("CreateNamespace").inject(func() error { + cp1, err = d.MetadataStore.CreateNamespace(ctx, request) return err }) return } // DeleteNamespace wraps MetadataStore.DeleteNamespace. -func (_d faultInjectionMetadataStore) DeleteNamespace(ctx context.Context, request *_sourcePersistence.DeleteNamespaceRequest) (err error) { - err = _d.generator.generate("DeleteNamespace").inject(func() error { - err = _d.MetadataStore.DeleteNamespace(ctx, request) +func (d faultInjectionMetadataStore) DeleteNamespace(ctx context.Context, request *_sourcePersistence.DeleteNamespaceRequest) (err error) { + err = d.generator.generate("DeleteNamespace").inject(func() error { + err = d.MetadataStore.DeleteNamespace(ctx, request) return err }) return } // DeleteNamespaceByName wraps MetadataStore.DeleteNamespaceByName. -func (_d faultInjectionMetadataStore) DeleteNamespaceByName(ctx context.Context, request *_sourcePersistence.DeleteNamespaceByNameRequest) (err error) { - err = _d.generator.generate("DeleteNamespaceByName").inject(func() error { - err = _d.MetadataStore.DeleteNamespaceByName(ctx, request) +func (d faultInjectionMetadataStore) DeleteNamespaceByName(ctx context.Context, request *_sourcePersistence.DeleteNamespaceByNameRequest) (err error) { + err = d.generator.generate("DeleteNamespaceByName").inject(func() error { + err = d.MetadataStore.DeleteNamespaceByName(ctx, request) return err }) return } // GetNamespace wraps MetadataStore.GetNamespace. -func (_d faultInjectionMetadataStore) GetNamespace(ctx context.Context, request *_sourcePersistence.GetNamespaceRequest) (ip1 *_sourcePersistence.InternalGetNamespaceResponse, err error) { - err = _d.generator.generate("GetNamespace").inject(func() error { - ip1, err = _d.MetadataStore.GetNamespace(ctx, request) +func (d faultInjectionMetadataStore) GetNamespace(ctx context.Context, request *_sourcePersistence.GetNamespaceRequest) (ip1 *_sourcePersistence.InternalGetNamespaceResponse, err error) { + err = d.generator.generate("GetNamespace").inject(func() error { + ip1, err = d.MetadataStore.GetNamespace(ctx, request) return err }) return } // ListNamespaces wraps MetadataStore.ListNamespaces. -func (_d faultInjectionMetadataStore) ListNamespaces(ctx context.Context, request *_sourcePersistence.InternalListNamespacesRequest) (ip1 *_sourcePersistence.InternalListNamespacesResponse, err error) { - err = _d.generator.generate("ListNamespaces").inject(func() error { - ip1, err = _d.MetadataStore.ListNamespaces(ctx, request) +func (d faultInjectionMetadataStore) ListNamespaces(ctx context.Context, request *_sourcePersistence.InternalListNamespacesRequest) (ip1 *_sourcePersistence.InternalListNamespacesResponse, err error) { + err = d.generator.generate("ListNamespaces").inject(func() error { + ip1, err = d.MetadataStore.ListNamespaces(ctx, request) return err }) return } // RenameNamespace wraps MetadataStore.RenameNamespace. -func (_d faultInjectionMetadataStore) RenameNamespace(ctx context.Context, request *_sourcePersistence.InternalRenameNamespaceRequest) (err error) { - err = _d.generator.generate("RenameNamespace").inject(func() error { - err = _d.MetadataStore.RenameNamespace(ctx, request) +func (d faultInjectionMetadataStore) RenameNamespace(ctx context.Context, request *_sourcePersistence.InternalRenameNamespaceRequest) (err error) { + err = d.generator.generate("RenameNamespace").inject(func() error { + err = d.MetadataStore.RenameNamespace(ctx, request) return err }) return } // UpdateNamespace wraps MetadataStore.UpdateNamespace. -func (_d faultInjectionMetadataStore) UpdateNamespace(ctx context.Context, request *_sourcePersistence.InternalUpdateNamespaceRequest) (err error) { - err = _d.generator.generate("UpdateNamespace").inject(func() error { - err = _d.MetadataStore.UpdateNamespace(ctx, request) +func (d faultInjectionMetadataStore) UpdateNamespace(ctx context.Context, request *_sourcePersistence.InternalUpdateNamespaceRequest) (err error) { + err = d.generator.generate("UpdateNamespace").inject(func() error { + err = d.MetadataStore.UpdateNamespace(ctx, request) return err }) return diff --git a/common/persistence/faultinjection/nexus_endpoint_store_gen.go b/common/persistence/faultinjection/nexus_endpoint_store_gen.go index b4000c4ca0e..7fed55128a6 100644 --- a/common/persistence/faultinjection/nexus_endpoint_store_gen.go +++ b/common/persistence/faultinjection/nexus_endpoint_store_gen.go @@ -56,36 +56,36 @@ func newFaultInjectionNexusEndpointStore( } // CreateOrUpdateNexusEndpoint wraps NexusEndpointStore.CreateOrUpdateNexusEndpoint. -func (_d faultInjectionNexusEndpointStore) CreateOrUpdateNexusEndpoint(ctx context.Context, request *_sourcePersistence.InternalCreateOrUpdateNexusEndpointRequest) (err error) { - err = _d.generator.generate("CreateOrUpdateNexusEndpoint").inject(func() error { - err = _d.NexusEndpointStore.CreateOrUpdateNexusEndpoint(ctx, request) +func (d faultInjectionNexusEndpointStore) CreateOrUpdateNexusEndpoint(ctx context.Context, request *_sourcePersistence.InternalCreateOrUpdateNexusEndpointRequest) (err error) { + err = d.generator.generate("CreateOrUpdateNexusEndpoint").inject(func() error { + err = d.NexusEndpointStore.CreateOrUpdateNexusEndpoint(ctx, request) return err }) return } // DeleteNexusEndpoint wraps NexusEndpointStore.DeleteNexusEndpoint. -func (_d faultInjectionNexusEndpointStore) DeleteNexusEndpoint(ctx context.Context, request *_sourcePersistence.DeleteNexusEndpointRequest) (err error) { - err = _d.generator.generate("DeleteNexusEndpoint").inject(func() error { - err = _d.NexusEndpointStore.DeleteNexusEndpoint(ctx, request) +func (d faultInjectionNexusEndpointStore) DeleteNexusEndpoint(ctx context.Context, request *_sourcePersistence.DeleteNexusEndpointRequest) (err error) { + err = d.generator.generate("DeleteNexusEndpoint").inject(func() error { + err = d.NexusEndpointStore.DeleteNexusEndpoint(ctx, request) return err }) return } // GetNexusEndpoint wraps NexusEndpointStore.GetNexusEndpoint. -func (_d faultInjectionNexusEndpointStore) GetNexusEndpoint(ctx context.Context, request *_sourcePersistence.GetNexusEndpointRequest) (ip1 *_sourcePersistence.InternalNexusEndpoint, err error) { - err = _d.generator.generate("GetNexusEndpoint").inject(func() error { - ip1, err = _d.NexusEndpointStore.GetNexusEndpoint(ctx, request) +func (d faultInjectionNexusEndpointStore) GetNexusEndpoint(ctx context.Context, request *_sourcePersistence.GetNexusEndpointRequest) (ip1 *_sourcePersistence.InternalNexusEndpoint, err error) { + err = d.generator.generate("GetNexusEndpoint").inject(func() error { + ip1, err = d.NexusEndpointStore.GetNexusEndpoint(ctx, request) return err }) return } // ListNexusEndpoints wraps NexusEndpointStore.ListNexusEndpoints. -func (_d faultInjectionNexusEndpointStore) ListNexusEndpoints(ctx context.Context, request *_sourcePersistence.ListNexusEndpointsRequest) (ip1 *_sourcePersistence.InternalListNexusEndpointsResponse, err error) { - err = _d.generator.generate("ListNexusEndpoints").inject(func() error { - ip1, err = _d.NexusEndpointStore.ListNexusEndpoints(ctx, request) +func (d faultInjectionNexusEndpointStore) ListNexusEndpoints(ctx context.Context, request *_sourcePersistence.ListNexusEndpointsRequest) (ip1 *_sourcePersistence.InternalListNexusEndpointsResponse, err error) { + err = d.generator.generate("ListNexusEndpoints").inject(func() error { + ip1, err = d.NexusEndpointStore.ListNexusEndpoints(ctx, request) return err }) return diff --git a/common/persistence/faultinjection/queue_gen.go b/common/persistence/faultinjection/queue_gen.go index 18ad8e24c06..770f300f2a4 100644 --- a/common/persistence/faultinjection/queue_gen.go +++ b/common/persistence/faultinjection/queue_gen.go @@ -57,90 +57,90 @@ func newFaultInjectionQueue( } // DeleteMessageFromDLQ wraps Queue.DeleteMessageFromDLQ. -func (_d faultInjectionQueue) DeleteMessageFromDLQ(ctx context.Context, messageID int64) (err error) { - err = _d.generator.generate("DeleteMessageFromDLQ").inject(func() error { - err = _d.Queue.DeleteMessageFromDLQ(ctx, messageID) +func (d faultInjectionQueue) DeleteMessageFromDLQ(ctx context.Context, messageID int64) (err error) { + err = d.generator.generate("DeleteMessageFromDLQ").inject(func() error { + err = d.Queue.DeleteMessageFromDLQ(ctx, messageID) return err }) return } // DeleteMessagesBefore wraps Queue.DeleteMessagesBefore. -func (_d faultInjectionQueue) DeleteMessagesBefore(ctx context.Context, messageID int64) (err error) { - err = _d.generator.generate("DeleteMessagesBefore").inject(func() error { - err = _d.Queue.DeleteMessagesBefore(ctx, messageID) +func (d faultInjectionQueue) DeleteMessagesBefore(ctx context.Context, messageID int64) (err error) { + err = d.generator.generate("DeleteMessagesBefore").inject(func() error { + err = d.Queue.DeleteMessagesBefore(ctx, messageID) return err }) return } // EnqueueMessage wraps Queue.EnqueueMessage. -func (_d faultInjectionQueue) EnqueueMessage(ctx context.Context, blob *commonpb.DataBlob) (err error) { - err = _d.generator.generate("EnqueueMessage").inject(func() error { - err = _d.Queue.EnqueueMessage(ctx, blob) +func (d faultInjectionQueue) EnqueueMessage(ctx context.Context, blob *commonpb.DataBlob) (err error) { + err = d.generator.generate("EnqueueMessage").inject(func() error { + err = d.Queue.EnqueueMessage(ctx, blob) return err }) return } // EnqueueMessageToDLQ wraps Queue.EnqueueMessageToDLQ. -func (_d faultInjectionQueue) EnqueueMessageToDLQ(ctx context.Context, blob *commonpb.DataBlob) (i1 int64, err error) { - err = _d.generator.generate("EnqueueMessageToDLQ").inject(func() error { - i1, err = _d.Queue.EnqueueMessageToDLQ(ctx, blob) +func (d faultInjectionQueue) EnqueueMessageToDLQ(ctx context.Context, blob *commonpb.DataBlob) (i1 int64, err error) { + err = d.generator.generate("EnqueueMessageToDLQ").inject(func() error { + i1, err = d.Queue.EnqueueMessageToDLQ(ctx, blob) return err }) return } // Init wraps Queue.Init. -func (_d faultInjectionQueue) Init(ctx context.Context, blob *commonpb.DataBlob) (err error) { - err = _d.generator.generate("Init").inject(func() error { - err = _d.Queue.Init(ctx, blob) +func (d faultInjectionQueue) Init(ctx context.Context, blob *commonpb.DataBlob) (err error) { + err = d.generator.generate("Init").inject(func() error { + err = d.Queue.Init(ctx, blob) return err }) return } // RangeDeleteMessagesFromDLQ wraps Queue.RangeDeleteMessagesFromDLQ. -func (_d faultInjectionQueue) RangeDeleteMessagesFromDLQ(ctx context.Context, firstMessageID int64, lastMessageID int64) (err error) { - err = _d.generator.generate("RangeDeleteMessagesFromDLQ").inject(func() error { - err = _d.Queue.RangeDeleteMessagesFromDLQ(ctx, firstMessageID, lastMessageID) +func (d faultInjectionQueue) RangeDeleteMessagesFromDLQ(ctx context.Context, firstMessageID int64, lastMessageID int64) (err error) { + err = d.generator.generate("RangeDeleteMessagesFromDLQ").inject(func() error { + err = d.Queue.RangeDeleteMessagesFromDLQ(ctx, firstMessageID, lastMessageID) return err }) return } // ReadMessages wraps Queue.ReadMessages. -func (_d faultInjectionQueue) ReadMessages(ctx context.Context, lastMessageID int64, maxCount int) (qpa1 []*_sourcePersistence.QueueMessage, err error) { - err = _d.generator.generate("ReadMessages").inject(func() error { - qpa1, err = _d.Queue.ReadMessages(ctx, lastMessageID, maxCount) +func (d faultInjectionQueue) ReadMessages(ctx context.Context, lastMessageID int64, maxCount int) (qpa1 []*_sourcePersistence.QueueMessage, err error) { + err = d.generator.generate("ReadMessages").inject(func() error { + qpa1, err = d.Queue.ReadMessages(ctx, lastMessageID, maxCount) return err }) return } // ReadMessagesFromDLQ wraps Queue.ReadMessagesFromDLQ. -func (_d faultInjectionQueue) ReadMessagesFromDLQ(ctx context.Context, firstMessageID int64, lastMessageID int64, pageSize int, pageToken []byte) (qpa1 []*_sourcePersistence.QueueMessage, ba1 []byte, err error) { - err = _d.generator.generate("ReadMessagesFromDLQ").inject(func() error { - qpa1, ba1, err = _d.Queue.ReadMessagesFromDLQ(ctx, firstMessageID, lastMessageID, pageSize, pageToken) +func (d faultInjectionQueue) ReadMessagesFromDLQ(ctx context.Context, firstMessageID int64, lastMessageID int64, pageSize int, pageToken []byte) (qpa1 []*_sourcePersistence.QueueMessage, ba1 []byte, err error) { + err = d.generator.generate("ReadMessagesFromDLQ").inject(func() error { + qpa1, ba1, err = d.Queue.ReadMessagesFromDLQ(ctx, firstMessageID, lastMessageID, pageSize, pageToken) return err }) return } // UpdateAckLevel wraps Queue.UpdateAckLevel. -func (_d faultInjectionQueue) UpdateAckLevel(ctx context.Context, metadata *_sourcePersistence.InternalQueueMetadata) (err error) { - err = _d.generator.generate("UpdateAckLevel").inject(func() error { - err = _d.Queue.UpdateAckLevel(ctx, metadata) +func (d faultInjectionQueue) UpdateAckLevel(ctx context.Context, metadata *_sourcePersistence.InternalQueueMetadata) (err error) { + err = d.generator.generate("UpdateAckLevel").inject(func() error { + err = d.Queue.UpdateAckLevel(ctx, metadata) return err }) return } // UpdateDLQAckLevel wraps Queue.UpdateDLQAckLevel. -func (_d faultInjectionQueue) UpdateDLQAckLevel(ctx context.Context, metadata *_sourcePersistence.InternalQueueMetadata) (err error) { - err = _d.generator.generate("UpdateDLQAckLevel").inject(func() error { - err = _d.Queue.UpdateDLQAckLevel(ctx, metadata) +func (d faultInjectionQueue) UpdateDLQAckLevel(ctx context.Context, metadata *_sourcePersistence.InternalQueueMetadata) (err error) { + err = d.generator.generate("UpdateDLQAckLevel").inject(func() error { + err = d.Queue.UpdateDLQAckLevel(ctx, metadata) return err }) return diff --git a/common/persistence/faultinjection/queue_v2_gen.go b/common/persistence/faultinjection/queue_v2_gen.go index 0f467adc08d..995b9cea768 100644 --- a/common/persistence/faultinjection/queue_v2_gen.go +++ b/common/persistence/faultinjection/queue_v2_gen.go @@ -56,45 +56,45 @@ func newFaultInjectionQueueV2( } // CreateQueue wraps QueueV2.CreateQueue. -func (_d faultInjectionQueueV2) CreateQueue(ctx context.Context, request *_sourcePersistence.InternalCreateQueueRequest) (ip1 *_sourcePersistence.InternalCreateQueueResponse, err error) { - err = _d.generator.generate("CreateQueue").inject(func() error { - ip1, err = _d.QueueV2.CreateQueue(ctx, request) +func (d faultInjectionQueueV2) CreateQueue(ctx context.Context, request *_sourcePersistence.InternalCreateQueueRequest) (ip1 *_sourcePersistence.InternalCreateQueueResponse, err error) { + err = d.generator.generate("CreateQueue").inject(func() error { + ip1, err = d.QueueV2.CreateQueue(ctx, request) return err }) return } // EnqueueMessage wraps QueueV2.EnqueueMessage. -func (_d faultInjectionQueueV2) EnqueueMessage(ctx context.Context, request *_sourcePersistence.InternalEnqueueMessageRequest) (ip1 *_sourcePersistence.InternalEnqueueMessageResponse, err error) { - err = _d.generator.generate("EnqueueMessage").inject(func() error { - ip1, err = _d.QueueV2.EnqueueMessage(ctx, request) +func (d faultInjectionQueueV2) EnqueueMessage(ctx context.Context, request *_sourcePersistence.InternalEnqueueMessageRequest) (ip1 *_sourcePersistence.InternalEnqueueMessageResponse, err error) { + err = d.generator.generate("EnqueueMessage").inject(func() error { + ip1, err = d.QueueV2.EnqueueMessage(ctx, request) return err }) return } // ListQueues wraps QueueV2.ListQueues. -func (_d faultInjectionQueueV2) ListQueues(ctx context.Context, request *_sourcePersistence.InternalListQueuesRequest) (ip1 *_sourcePersistence.InternalListQueuesResponse, err error) { - err = _d.generator.generate("ListQueues").inject(func() error { - ip1, err = _d.QueueV2.ListQueues(ctx, request) +func (d faultInjectionQueueV2) ListQueues(ctx context.Context, request *_sourcePersistence.InternalListQueuesRequest) (ip1 *_sourcePersistence.InternalListQueuesResponse, err error) { + err = d.generator.generate("ListQueues").inject(func() error { + ip1, err = d.QueueV2.ListQueues(ctx, request) return err }) return } // RangeDeleteMessages wraps QueueV2.RangeDeleteMessages. -func (_d faultInjectionQueueV2) RangeDeleteMessages(ctx context.Context, request *_sourcePersistence.InternalRangeDeleteMessagesRequest) (ip1 *_sourcePersistence.InternalRangeDeleteMessagesResponse, err error) { - err = _d.generator.generate("RangeDeleteMessages").inject(func() error { - ip1, err = _d.QueueV2.RangeDeleteMessages(ctx, request) +func (d faultInjectionQueueV2) RangeDeleteMessages(ctx context.Context, request *_sourcePersistence.InternalRangeDeleteMessagesRequest) (ip1 *_sourcePersistence.InternalRangeDeleteMessagesResponse, err error) { + err = d.generator.generate("RangeDeleteMessages").inject(func() error { + ip1, err = d.QueueV2.RangeDeleteMessages(ctx, request) return err }) return } // ReadMessages wraps QueueV2.ReadMessages. -func (_d faultInjectionQueueV2) ReadMessages(ctx context.Context, request *_sourcePersistence.InternalReadMessagesRequest) (ip1 *_sourcePersistence.InternalReadMessagesResponse, err error) { - err = _d.generator.generate("ReadMessages").inject(func() error { - ip1, err = _d.QueueV2.ReadMessages(ctx, request) +func (d faultInjectionQueueV2) ReadMessages(ctx context.Context, request *_sourcePersistence.InternalReadMessagesRequest) (ip1 *_sourcePersistence.InternalReadMessagesResponse, err error) { + err = d.generator.generate("ReadMessages").inject(func() error { + ip1, err = d.QueueV2.ReadMessages(ctx, request) return err }) return diff --git a/common/persistence/faultinjection/shard_store_gen.go b/common/persistence/faultinjection/shard_store_gen.go index 7d7c588b461..589991264b4 100644 --- a/common/persistence/faultinjection/shard_store_gen.go +++ b/common/persistence/faultinjection/shard_store_gen.go @@ -56,27 +56,27 @@ func newFaultInjectionShardStore( } // AssertShardOwnership wraps ShardStore.AssertShardOwnership. -func (_d faultInjectionShardStore) AssertShardOwnership(ctx context.Context, request *_sourcePersistence.AssertShardOwnershipRequest) (err error) { - err = _d.generator.generate("AssertShardOwnership").inject(func() error { - err = _d.ShardStore.AssertShardOwnership(ctx, request) +func (d faultInjectionShardStore) AssertShardOwnership(ctx context.Context, request *_sourcePersistence.AssertShardOwnershipRequest) (err error) { + err = d.generator.generate("AssertShardOwnership").inject(func() error { + err = d.ShardStore.AssertShardOwnership(ctx, request) return err }) return } // GetOrCreateShard wraps ShardStore.GetOrCreateShard. -func (_d faultInjectionShardStore) GetOrCreateShard(ctx context.Context, request *_sourcePersistence.InternalGetOrCreateShardRequest) (ip1 *_sourcePersistence.InternalGetOrCreateShardResponse, err error) { - err = _d.generator.generate("GetOrCreateShard").inject(func() error { - ip1, err = _d.ShardStore.GetOrCreateShard(ctx, request) +func (d faultInjectionShardStore) GetOrCreateShard(ctx context.Context, request *_sourcePersistence.InternalGetOrCreateShardRequest) (ip1 *_sourcePersistence.InternalGetOrCreateShardResponse, err error) { + err = d.generator.generate("GetOrCreateShard").inject(func() error { + ip1, err = d.ShardStore.GetOrCreateShard(ctx, request) return err }) return } // UpdateShard wraps ShardStore.UpdateShard. -func (_d faultInjectionShardStore) UpdateShard(ctx context.Context, request *_sourcePersistence.InternalUpdateShardRequest) (err error) { - err = _d.generator.generate("UpdateShard").inject(func() error { - err = _d.ShardStore.UpdateShard(ctx, request) +func (d faultInjectionShardStore) UpdateShard(ctx context.Context, request *_sourcePersistence.InternalUpdateShardRequest) (err error) { + err = d.generator.generate("UpdateShard").inject(func() error { + err = d.ShardStore.UpdateShard(ctx, request) return err }) return diff --git a/common/persistence/faultinjection/task_store_gen.go b/common/persistence/faultinjection/task_store_gen.go index 3eba62b6b7b..0f857c81d1c 100644 --- a/common/persistence/faultinjection/task_store_gen.go +++ b/common/persistence/faultinjection/task_store_gen.go @@ -56,117 +56,117 @@ func newFaultInjectionTaskStore( } // CompleteTasksLessThan wraps TaskStore.CompleteTasksLessThan. -func (_d faultInjectionTaskStore) CompleteTasksLessThan(ctx context.Context, request *_sourcePersistence.CompleteTasksLessThanRequest) (i1 int, err error) { - err = _d.generator.generate("CompleteTasksLessThan").inject(func() error { - i1, err = _d.TaskStore.CompleteTasksLessThan(ctx, request) +func (d faultInjectionTaskStore) CompleteTasksLessThan(ctx context.Context, request *_sourcePersistence.CompleteTasksLessThanRequest) (i1 int, err error) { + err = d.generator.generate("CompleteTasksLessThan").inject(func() error { + i1, err = d.TaskStore.CompleteTasksLessThan(ctx, request) return err }) return } // CountTaskQueuesByBuildId wraps TaskStore.CountTaskQueuesByBuildId. -func (_d faultInjectionTaskStore) CountTaskQueuesByBuildId(ctx context.Context, request *_sourcePersistence.CountTaskQueuesByBuildIdRequest) (i1 int, err error) { - err = _d.generator.generate("CountTaskQueuesByBuildId").inject(func() error { - i1, err = _d.TaskStore.CountTaskQueuesByBuildId(ctx, request) +func (d faultInjectionTaskStore) CountTaskQueuesByBuildId(ctx context.Context, request *_sourcePersistence.CountTaskQueuesByBuildIdRequest) (i1 int, err error) { + err = d.generator.generate("CountTaskQueuesByBuildId").inject(func() error { + i1, err = d.TaskStore.CountTaskQueuesByBuildId(ctx, request) return err }) return } // CreateTaskQueue wraps TaskStore.CreateTaskQueue. -func (_d faultInjectionTaskStore) CreateTaskQueue(ctx context.Context, request *_sourcePersistence.InternalCreateTaskQueueRequest) (err error) { - err = _d.generator.generate("CreateTaskQueue").inject(func() error { - err = _d.TaskStore.CreateTaskQueue(ctx, request) +func (d faultInjectionTaskStore) CreateTaskQueue(ctx context.Context, request *_sourcePersistence.InternalCreateTaskQueueRequest) (err error) { + err = d.generator.generate("CreateTaskQueue").inject(func() error { + err = d.TaskStore.CreateTaskQueue(ctx, request) return err }) return } // CreateTasks wraps TaskStore.CreateTasks. -func (_d faultInjectionTaskStore) CreateTasks(ctx context.Context, request *_sourcePersistence.InternalCreateTasksRequest) (cp1 *_sourcePersistence.CreateTasksResponse, err error) { - err = _d.generator.generate("CreateTasks").inject(func() error { - cp1, err = _d.TaskStore.CreateTasks(ctx, request) +func (d faultInjectionTaskStore) CreateTasks(ctx context.Context, request *_sourcePersistence.InternalCreateTasksRequest) (cp1 *_sourcePersistence.CreateTasksResponse, err error) { + err = d.generator.generate("CreateTasks").inject(func() error { + cp1, err = d.TaskStore.CreateTasks(ctx, request) return err }) return } // DeleteTaskQueue wraps TaskStore.DeleteTaskQueue. -func (_d faultInjectionTaskStore) DeleteTaskQueue(ctx context.Context, request *_sourcePersistence.DeleteTaskQueueRequest) (err error) { - err = _d.generator.generate("DeleteTaskQueue").inject(func() error { - err = _d.TaskStore.DeleteTaskQueue(ctx, request) +func (d faultInjectionTaskStore) DeleteTaskQueue(ctx context.Context, request *_sourcePersistence.DeleteTaskQueueRequest) (err error) { + err = d.generator.generate("DeleteTaskQueue").inject(func() error { + err = d.TaskStore.DeleteTaskQueue(ctx, request) return err }) return } // GetTaskQueue wraps TaskStore.GetTaskQueue. -func (_d faultInjectionTaskStore) GetTaskQueue(ctx context.Context, request *_sourcePersistence.InternalGetTaskQueueRequest) (ip1 *_sourcePersistence.InternalGetTaskQueueResponse, err error) { - err = _d.generator.generate("GetTaskQueue").inject(func() error { - ip1, err = _d.TaskStore.GetTaskQueue(ctx, request) +func (d faultInjectionTaskStore) GetTaskQueue(ctx context.Context, request *_sourcePersistence.InternalGetTaskQueueRequest) (ip1 *_sourcePersistence.InternalGetTaskQueueResponse, err error) { + err = d.generator.generate("GetTaskQueue").inject(func() error { + ip1, err = d.TaskStore.GetTaskQueue(ctx, request) return err }) return } // GetTaskQueueUserData wraps TaskStore.GetTaskQueueUserData. -func (_d faultInjectionTaskStore) GetTaskQueueUserData(ctx context.Context, request *_sourcePersistence.GetTaskQueueUserDataRequest) (ip1 *_sourcePersistence.InternalGetTaskQueueUserDataResponse, err error) { - err = _d.generator.generate("GetTaskQueueUserData").inject(func() error { - ip1, err = _d.TaskStore.GetTaskQueueUserData(ctx, request) +func (d faultInjectionTaskStore) GetTaskQueueUserData(ctx context.Context, request *_sourcePersistence.GetTaskQueueUserDataRequest) (ip1 *_sourcePersistence.InternalGetTaskQueueUserDataResponse, err error) { + err = d.generator.generate("GetTaskQueueUserData").inject(func() error { + ip1, err = d.TaskStore.GetTaskQueueUserData(ctx, request) return err }) return } // GetTaskQueuesByBuildId wraps TaskStore.GetTaskQueuesByBuildId. -func (_d faultInjectionTaskStore) GetTaskQueuesByBuildId(ctx context.Context, request *_sourcePersistence.GetTaskQueuesByBuildIdRequest) (sa1 []string, err error) { - err = _d.generator.generate("GetTaskQueuesByBuildId").inject(func() error { - sa1, err = _d.TaskStore.GetTaskQueuesByBuildId(ctx, request) +func (d faultInjectionTaskStore) GetTaskQueuesByBuildId(ctx context.Context, request *_sourcePersistence.GetTaskQueuesByBuildIdRequest) (sa1 []string, err error) { + err = d.generator.generate("GetTaskQueuesByBuildId").inject(func() error { + sa1, err = d.TaskStore.GetTaskQueuesByBuildId(ctx, request) return err }) return } // GetTasks wraps TaskStore.GetTasks. -func (_d faultInjectionTaskStore) GetTasks(ctx context.Context, request *_sourcePersistence.GetTasksRequest) (ip1 *_sourcePersistence.InternalGetTasksResponse, err error) { - err = _d.generator.generate("GetTasks").inject(func() error { - ip1, err = _d.TaskStore.GetTasks(ctx, request) +func (d faultInjectionTaskStore) GetTasks(ctx context.Context, request *_sourcePersistence.GetTasksRequest) (ip1 *_sourcePersistence.InternalGetTasksResponse, err error) { + err = d.generator.generate("GetTasks").inject(func() error { + ip1, err = d.TaskStore.GetTasks(ctx, request) return err }) return } // ListTaskQueue wraps TaskStore.ListTaskQueue. -func (_d faultInjectionTaskStore) ListTaskQueue(ctx context.Context, request *_sourcePersistence.ListTaskQueueRequest) (ip1 *_sourcePersistence.InternalListTaskQueueResponse, err error) { - err = _d.generator.generate("ListTaskQueue").inject(func() error { - ip1, err = _d.TaskStore.ListTaskQueue(ctx, request) +func (d faultInjectionTaskStore) ListTaskQueue(ctx context.Context, request *_sourcePersistence.ListTaskQueueRequest) (ip1 *_sourcePersistence.InternalListTaskQueueResponse, err error) { + err = d.generator.generate("ListTaskQueue").inject(func() error { + ip1, err = d.TaskStore.ListTaskQueue(ctx, request) return err }) return } // ListTaskQueueUserDataEntries wraps TaskStore.ListTaskQueueUserDataEntries. -func (_d faultInjectionTaskStore) ListTaskQueueUserDataEntries(ctx context.Context, request *_sourcePersistence.ListTaskQueueUserDataEntriesRequest) (ip1 *_sourcePersistence.InternalListTaskQueueUserDataEntriesResponse, err error) { - err = _d.generator.generate("ListTaskQueueUserDataEntries").inject(func() error { - ip1, err = _d.TaskStore.ListTaskQueueUserDataEntries(ctx, request) +func (d faultInjectionTaskStore) ListTaskQueueUserDataEntries(ctx context.Context, request *_sourcePersistence.ListTaskQueueUserDataEntriesRequest) (ip1 *_sourcePersistence.InternalListTaskQueueUserDataEntriesResponse, err error) { + err = d.generator.generate("ListTaskQueueUserDataEntries").inject(func() error { + ip1, err = d.TaskStore.ListTaskQueueUserDataEntries(ctx, request) return err }) return } // UpdateTaskQueue wraps TaskStore.UpdateTaskQueue. -func (_d faultInjectionTaskStore) UpdateTaskQueue(ctx context.Context, request *_sourcePersistence.InternalUpdateTaskQueueRequest) (up1 *_sourcePersistence.UpdateTaskQueueResponse, err error) { - err = _d.generator.generate("UpdateTaskQueue").inject(func() error { - up1, err = _d.TaskStore.UpdateTaskQueue(ctx, request) +func (d faultInjectionTaskStore) UpdateTaskQueue(ctx context.Context, request *_sourcePersistence.InternalUpdateTaskQueueRequest) (up1 *_sourcePersistence.UpdateTaskQueueResponse, err error) { + err = d.generator.generate("UpdateTaskQueue").inject(func() error { + up1, err = d.TaskStore.UpdateTaskQueue(ctx, request) return err }) return } // UpdateTaskQueueUserData wraps TaskStore.UpdateTaskQueueUserData. -func (_d faultInjectionTaskStore) UpdateTaskQueueUserData(ctx context.Context, request *_sourcePersistence.InternalUpdateTaskQueueUserDataRequest) (err error) { - err = _d.generator.generate("UpdateTaskQueueUserData").inject(func() error { - err = _d.TaskStore.UpdateTaskQueueUserData(ctx, request) +func (d faultInjectionTaskStore) UpdateTaskQueueUserData(ctx context.Context, request *_sourcePersistence.InternalUpdateTaskQueueUserDataRequest) (err error) { + err = d.generator.generate("UpdateTaskQueueUserData").inject(func() error { + err = d.TaskStore.UpdateTaskQueueUserData(ctx, request) return err }) return