Skip to content

Commit

Permalink
Update thrift clients to use generated code (cadence-workflow#5599)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaddoll authored Jan 18, 2024
1 parent f5a7fa7 commit 4fadbc7
Show file tree
Hide file tree
Showing 29 changed files with 1,300 additions and 1,155 deletions.
1 change: 1 addition & 0 deletions client/admin/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
//go:generate gowrap gen -g -p . -i Client -t ../templates/metered.tmpl -o ../wrappers/metered/admin_generated.go -v client=Admin
//go:generate gowrap gen -g -p . -i Client -t ../templates/errorinjectors.tmpl -o ../wrappers/errorinjectors/admin_generated.go -v client=Admin
//go:generate gowrap gen -g -p . -i Client -t ../templates/grpc.tmpl -o ../wrappers/grpc/admin_generated.go -v client=Admin -v package=adminv1 -v path=github.com/uber/cadence-idl/go/proto/admin/v1 -v prefix=Admin
//go:generate gowrap gen -g -p . -i Client -t ../templates/thrift.tmpl -o ../wrappers/thrift/admin_generated.go -v client=Admin -v prefix=Admin

// Client is the interface exposed by admin service client
type Client interface {
Expand Down
199 changes: 0 additions & 199 deletions client/admin/thriftClient.go

This file was deleted.

9 changes: 5 additions & 4 deletions client/clientfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"github.com/uber/cadence/client/wrappers/errorinjectors"
"github.com/uber/cadence/client/wrappers/grpc"
"github.com/uber/cadence/client/wrappers/metered"
"github.com/uber/cadence/client/wrappers/thrift"
"github.com/uber/cadence/common"
"github.com/uber/cadence/common/dynamicconfig"
"github.com/uber/cadence/common/log"
Expand Down Expand Up @@ -111,7 +112,7 @@ func (cf *rpcClientFactory) NewHistoryClientWithTimeout(timeout time.Duration) (
rawClient = grpc.NewHistoryClient(historyv1.NewHistoryAPIYARPCClient(outboundConfig))
namedPort = membership.PortGRPC
} else {
rawClient = history.NewThriftClient(historyserviceclient.New(outboundConfig))
rawClient = thrift.NewHistoryClient(historyserviceclient.New(outboundConfig))
}

peerResolver := history.NewPeerResolver(cf.numberOfHistoryShards, cf.resolver, namedPort)
Expand Down Expand Up @@ -145,7 +146,7 @@ func (cf *rpcClientFactory) NewMatchingClientWithTimeout(
rawClient = grpc.NewMatchingClient(matchingv1.NewMatchingAPIYARPCClient(outboundConfig))
namedPort = membership.PortGRPC
} else {
rawClient = matching.NewThriftClient(matchingserviceclient.New(outboundConfig))
rawClient = thrift.NewMatchingClient(matchingserviceclient.New(outboundConfig))
}

peerResolver := matching.NewPeerResolver(cf.resolver, namedPort)
Expand Down Expand Up @@ -176,7 +177,7 @@ func (cf *rpcClientFactory) NewAdminClientWithTimeoutAndConfig(
if rpc.IsGRPCOutbound(config) {
client = grpc.NewAdminClient(adminv1.NewAdminAPIYARPCClient(config))
} else {
client = admin.NewThriftClient(adminserviceclient.New(config))
client = thrift.NewAdminClient(adminserviceclient.New(config))
}

client = admin.NewClient(timeout, largeTimeout, client)
Expand All @@ -203,7 +204,7 @@ func (cf *rpcClientFactory) NewFrontendClientWithTimeoutAndConfig(
apiv1.NewVisibilityAPIYARPCClient(config),
)
} else {
client = frontend.NewThriftClient(workflowserviceclient.New(config))
client = thrift.NewFrontendClient(workflowserviceclient.New(config))
}

client = frontend.NewClient(timeout, longPollTimeout, client)
Expand Down
1 change: 1 addition & 0 deletions client/frontend/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
//go:generate gowrap gen -g -p . -i Client -t ../templates/metered.tmpl -o ../wrappers/metered/frontend_generated.go -v client=Frontend
//go:generate gowrap gen -g -p . -i Client -t ../templates/errorinjectors.tmpl -o ../wrappers/errorinjectors/frontend_generated.go -v client=Frontend
//go:generate gowrap gen -g -p . -i Client -t ../templates/grpc.tmpl -o ../wrappers/grpc/frontend_generated.go -v client=Frontend -v package=apiv1 -v path=github.com/uber/cadence-idl/go/proto/api/v1 -v prefix=
//go:generate gowrap gen -g -p . -i Client -t ../templates/thrift.tmpl -o ../wrappers/thrift/frontend_generated.go -v client=Frontend -v prefix=

// Client is the interface exposed by frontend service client
type Client interface {
Expand Down
Loading

0 comments on commit 4fadbc7

Please sign in to comment.