diff --git a/client/admin/client.go b/client/admin/client.go index 6b9399daafb..b3d0b7f79e3 100644 --- a/client/admin/client.go +++ b/client/admin/client.go @@ -35,7 +35,7 @@ import ( "go.temporal.io/server/common" ) -var _ Client = (*clientImpl)(nil) +var _ adminservice.AdminServiceClient = (*clientImpl)(nil) const ( // DefaultTimeout is the default timeout used to make calls @@ -55,7 +55,7 @@ func NewClient( timeout time.Duration, largeTimeout time.Duration, clients common.ClientCache, -) Client { +) adminservice.AdminServiceClient { return &clientImpl{ timeout: timeout, largeTimeout: largeTimeout, diff --git a/client/admin/interface.go b/client/admin/interface.go deleted file mode 100644 index d96d734780a..00000000000 --- a/client/admin/interface.go +++ /dev/null @@ -1,34 +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 admin - -import ( - "go.temporal.io/server/api/adminservice/v1" -) - -// Client is the interface exposed by admin service client -type Client interface { - adminservice.AdminServiceClient -} diff --git a/client/admin/metricClient.go b/client/admin/metricClient.go index 2f362edea20..ea4a2ef3473 100644 --- a/client/admin/metricClient.go +++ b/client/admin/metricClient.go @@ -33,15 +33,15 @@ import ( "go.temporal.io/server/common/metrics" ) -var _ Client = (*metricClient)(nil) +var _ adminservice.AdminServiceClient = (*metricClient)(nil) type metricClient struct { - client Client + client adminservice.AdminServiceClient metricsClient metrics.Client } -// NewMetricClient creates a new instance of Client that emits metrics -func NewMetricClient(client Client, metricsClient metrics.Client) Client { +// NewMetricClient creates a new instance of adminservice.AdminServiceClient that emits metrics +func NewMetricClient(client adminservice.AdminServiceClient, metricsClient metrics.Client) adminservice.AdminServiceClient { return &metricClient{ client: client, metricsClient: metricsClient, diff --git a/client/admin/retryableClient.go b/client/admin/retryableClient.go index 07a52331a2c..114b4cb3498 100644 --- a/client/admin/retryableClient.go +++ b/client/admin/retryableClient.go @@ -33,16 +33,16 @@ import ( "go.temporal.io/server/common/backoff" ) -var _ Client = (*retryableClient)(nil) +var _ adminservice.AdminServiceClient = (*retryableClient)(nil) type retryableClient struct { - client Client + client adminservice.AdminServiceClient policy backoff.RetryPolicy isRetryable backoff.IsRetryable } -// NewRetryableClient creates a new instance of Client with retry policy -func NewRetryableClient(client Client, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) Client { +// NewRetryableClient creates a new instance of adminservice.AdminServiceClient with retry policy +func NewRetryableClient(client adminservice.AdminServiceClient, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) adminservice.AdminServiceClient { return &retryableClient{ client: client, policy: policy, diff --git a/client/clientBean.go b/client/clientBean.go index 7750c37c612..74a4bc073df 100644 --- a/client/clientBean.go +++ b/client/clientBean.go @@ -31,35 +31,38 @@ import ( "sync" "sync/atomic" + "go.temporal.io/api/workflowservice/v1" + + "go.temporal.io/server/api/adminservice/v1" + "go.temporal.io/server/api/historyservice/v1" + "go.temporal.io/server/api/matchingservice/v1" "go.temporal.io/server/client/admin" "go.temporal.io/server/client/frontend" - "go.temporal.io/server/client/history" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common/cluster" ) type ( // Bean in an collection of clients Bean interface { - GetHistoryClient() history.Client - SetHistoryClient(client history.Client) - GetMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matching.Client, error) - SetMatchingClient(client matching.Client) - GetFrontendClient() frontend.Client - SetFrontendClient(client frontend.Client) - GetRemoteAdminClient(cluster string) admin.Client - SetRemoteAdminClient(cluster string, client admin.Client) - GetRemoteFrontendClient(cluster string) frontend.Client - SetRemoteFrontendClient(cluster string, client frontend.Client) + GetHistoryClient() historyservice.HistoryServiceClient + SetHistoryClient(client historyservice.HistoryServiceClient) + GetMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matchingservice.MatchingServiceClient, error) + SetMatchingClient(client matchingservice.MatchingServiceClient) + GetFrontendClient() workflowservice.WorkflowServiceClient + SetFrontendClient(client workflowservice.WorkflowServiceClient) + GetRemoteAdminClient(cluster string) adminservice.AdminServiceClient + SetRemoteAdminClient(cluster string, client adminservice.AdminServiceClient) + GetRemoteFrontendClient(cluster string) workflowservice.WorkflowServiceClient + SetRemoteFrontendClient(cluster string, client workflowservice.WorkflowServiceClient) } clientBeanImpl struct { sync.Mutex currentCluster string - historyClient history.Client + historyClient historyservice.HistoryServiceClient matchingClient atomic.Value - remoteAdminClients map[string]admin.Client - remoteFrontendClients map[string]frontend.Client + remoteAdminClients map[string]adminservice.AdminServiceClient + remoteFrontendClients map[string]workflowservice.WorkflowServiceClient factory Factory } ) @@ -72,8 +75,8 @@ func NewClientBean(factory Factory, clusterMetadata cluster.Metadata) (Bean, err return nil, err } - remoteAdminClients := map[string]admin.Client{} - remoteFrontendClients := map[string]frontend.Client{} + remoteAdminClients := map[string]adminservice.AdminServiceClient{} + remoteFrontendClients := map[string]workflowservice.WorkflowServiceClient{} for clusterName, info := range clusterMetadata.GetAllClusterInfo() { if !info.Enabled { @@ -111,40 +114,40 @@ func NewClientBean(factory Factory, clusterMetadata cluster.Metadata) (Bean, err }, nil } -func (h *clientBeanImpl) GetHistoryClient() history.Client { +func (h *clientBeanImpl) GetHistoryClient() historyservice.HistoryServiceClient { return h.historyClient } func (h *clientBeanImpl) SetHistoryClient( - client history.Client, + client historyservice.HistoryServiceClient, ) { h.historyClient = client } -func (h *clientBeanImpl) GetMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matching.Client, error) { +func (h *clientBeanImpl) GetMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matchingservice.MatchingServiceClient, error) { if client := h.matchingClient.Load(); client != nil { - return client.(matching.Client), nil + return client.(matchingservice.MatchingServiceClient), nil } return h.lazyInitMatchingClient(namespaceIDToName) } func (h *clientBeanImpl) SetMatchingClient( - client matching.Client, + client matchingservice.MatchingServiceClient, ) { h.matchingClient.Store(client) } -func (h *clientBeanImpl) GetFrontendClient() frontend.Client { +func (h *clientBeanImpl) GetFrontendClient() workflowservice.WorkflowServiceClient { return h.remoteFrontendClients[h.currentCluster] } func (h *clientBeanImpl) SetFrontendClient( - client frontend.Client, + client workflowservice.WorkflowServiceClient, ) { h.remoteFrontendClients[h.currentCluster] = client } -func (h *clientBeanImpl) GetRemoteAdminClient(cluster string) admin.Client { +func (h *clientBeanImpl) GetRemoteAdminClient(cluster string) adminservice.AdminServiceClient { client, ok := h.remoteAdminClients[cluster] if !ok { panic(fmt.Sprintf( @@ -158,12 +161,12 @@ func (h *clientBeanImpl) GetRemoteAdminClient(cluster string) admin.Client { func (h *clientBeanImpl) SetRemoteAdminClient( cluster string, - client admin.Client, + client adminservice.AdminServiceClient, ) { h.remoteAdminClients[cluster] = client } -func (h *clientBeanImpl) GetRemoteFrontendClient(cluster string) frontend.Client { +func (h *clientBeanImpl) GetRemoteFrontendClient(cluster string) workflowservice.WorkflowServiceClient { client, ok := h.remoteFrontendClients[cluster] if !ok { panic(fmt.Sprintf( @@ -177,16 +180,16 @@ func (h *clientBeanImpl) GetRemoteFrontendClient(cluster string) frontend.Client func (h *clientBeanImpl) SetRemoteFrontendClient( cluster string, - client frontend.Client, + client workflowservice.WorkflowServiceClient, ) { h.remoteFrontendClients[cluster] = client } -func (h *clientBeanImpl) lazyInitMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matching.Client, error) { +func (h *clientBeanImpl) lazyInitMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matchingservice.MatchingServiceClient, error) { h.Lock() defer h.Unlock() if cached := h.matchingClient.Load(); cached != nil { - return cached.(matching.Client), nil + return cached.(matchingservice.MatchingServiceClient), nil } client, err := h.factory.NewMatchingClient(namespaceIDToName) if err != nil { diff --git a/client/clientBean_mock.go b/client/clientBean_mock.go index 5c8c5208634..099417fa53f 100644 --- a/client/clientBean_mock.go +++ b/client/clientBean_mock.go @@ -32,10 +32,10 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - admin "go.temporal.io/server/client/admin" - frontend "go.temporal.io/server/client/frontend" - history "go.temporal.io/server/client/history" - matching "go.temporal.io/server/client/matching" + v1 "go.temporal.io/api/workflowservice/v1" + v10 "go.temporal.io/server/api/adminservice/v1" + v11 "go.temporal.io/server/api/historyservice/v1" + v12 "go.temporal.io/server/api/matchingservice/v1" ) // MockBean is a mock of Bean interface. @@ -62,10 +62,10 @@ func (m *MockBean) EXPECT() *MockBeanMockRecorder { } // GetFrontendClient mocks base method. -func (m *MockBean) GetFrontendClient() frontend.Client { +func (m *MockBean) GetFrontendClient() v1.WorkflowServiceClient { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetFrontendClient") - ret0, _ := ret[0].(frontend.Client) + ret0, _ := ret[0].(v1.WorkflowServiceClient) return ret0 } @@ -76,10 +76,10 @@ func (mr *MockBeanMockRecorder) GetFrontendClient() *gomock.Call { } // GetHistoryClient mocks base method. -func (m *MockBean) GetHistoryClient() history.Client { +func (m *MockBean) GetHistoryClient() v11.HistoryServiceClient { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetHistoryClient") - ret0, _ := ret[0].(history.Client) + ret0, _ := ret[0].(v11.HistoryServiceClient) return ret0 } @@ -90,10 +90,10 @@ func (mr *MockBeanMockRecorder) GetHistoryClient() *gomock.Call { } // GetMatchingClient mocks base method. -func (m *MockBean) GetMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matching.Client, error) { +func (m *MockBean) GetMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (v12.MatchingServiceClient, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetMatchingClient", namespaceIDToName) - ret0, _ := ret[0].(matching.Client) + ret0, _ := ret[0].(v12.MatchingServiceClient) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -105,10 +105,10 @@ func (mr *MockBeanMockRecorder) GetMatchingClient(namespaceIDToName interface{}) } // GetRemoteAdminClient mocks base method. -func (m *MockBean) GetRemoteAdminClient(cluster string) admin.Client { +func (m *MockBean) GetRemoteAdminClient(cluster string) v10.AdminServiceClient { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRemoteAdminClient", cluster) - ret0, _ := ret[0].(admin.Client) + ret0, _ := ret[0].(v10.AdminServiceClient) return ret0 } @@ -119,10 +119,10 @@ func (mr *MockBeanMockRecorder) GetRemoteAdminClient(cluster interface{}) *gomoc } // GetRemoteFrontendClient mocks base method. -func (m *MockBean) GetRemoteFrontendClient(cluster string) frontend.Client { +func (m *MockBean) GetRemoteFrontendClient(cluster string) v1.WorkflowServiceClient { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRemoteFrontendClient", cluster) - ret0, _ := ret[0].(frontend.Client) + ret0, _ := ret[0].(v1.WorkflowServiceClient) return ret0 } @@ -133,7 +133,7 @@ func (mr *MockBeanMockRecorder) GetRemoteFrontendClient(cluster interface{}) *go } // SetFrontendClient mocks base method. -func (m *MockBean) SetFrontendClient(client frontend.Client) { +func (m *MockBean) SetFrontendClient(client v1.WorkflowServiceClient) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetFrontendClient", client) } @@ -145,7 +145,7 @@ func (mr *MockBeanMockRecorder) SetFrontendClient(client interface{}) *gomock.Ca } // SetHistoryClient mocks base method. -func (m *MockBean) SetHistoryClient(client history.Client) { +func (m *MockBean) SetHistoryClient(client v11.HistoryServiceClient) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetHistoryClient", client) } @@ -157,7 +157,7 @@ func (mr *MockBeanMockRecorder) SetHistoryClient(client interface{}) *gomock.Cal } // SetMatchingClient mocks base method. -func (m *MockBean) SetMatchingClient(client matching.Client) { +func (m *MockBean) SetMatchingClient(client v12.MatchingServiceClient) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetMatchingClient", client) } @@ -169,7 +169,7 @@ func (mr *MockBeanMockRecorder) SetMatchingClient(client interface{}) *gomock.Ca } // SetRemoteAdminClient mocks base method. -func (m *MockBean) SetRemoteAdminClient(cluster string, client admin.Client) { +func (m *MockBean) SetRemoteAdminClient(cluster string, client v10.AdminServiceClient) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetRemoteAdminClient", cluster, client) } @@ -181,7 +181,7 @@ func (mr *MockBeanMockRecorder) SetRemoteAdminClient(cluster, client interface{} } // SetRemoteFrontendClient mocks base method. -func (m *MockBean) SetRemoteFrontendClient(cluster string, client frontend.Client) { +func (m *MockBean) SetRemoteFrontendClient(cluster string, client v1.WorkflowServiceClient) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetRemoteFrontendClient", cluster, client) } diff --git a/client/clientfactory.go b/client/clientfactory.go index acbc2ac454d..a32bb9454d4 100644 --- a/client/clientfactory.go +++ b/client/clientfactory.go @@ -50,14 +50,14 @@ const ( type ( // Factory can be used to create RPC clients for temporal services Factory interface { - NewHistoryClient() (history.Client, error) - NewMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matching.Client, error) - NewFrontendClient(rpcAddress string) (frontend.Client, error) + NewHistoryClient() (historyservice.HistoryServiceClient, error) + NewMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matchingservice.MatchingServiceClient, error) + NewFrontendClient(rpcAddress string) (workflowservice.WorkflowServiceClient, error) - NewHistoryClientWithTimeout(timeout time.Duration) (history.Client, error) - NewMatchingClientWithTimeout(namespaceIDToName NamespaceIDToNameFunc, timeout time.Duration, longPollTimeout time.Duration) (matching.Client, error) - NewFrontendClientWithTimeout(rpcAddress string, timeout time.Duration, longPollTimeout time.Duration) (frontend.Client, error) - NewAdminClientWithTimeout(rpcAddress string, timeout time.Duration, largeTimeout time.Duration) (admin.Client, error) + NewHistoryClientWithTimeout(timeout time.Duration) (historyservice.HistoryServiceClient, error) + NewMatchingClientWithTimeout(namespaceIDToName NamespaceIDToNameFunc, timeout time.Duration, longPollTimeout time.Duration) (matchingservice.MatchingServiceClient, error) + NewFrontendClientWithTimeout(rpcAddress string, timeout time.Duration, longPollTimeout time.Duration) (workflowservice.WorkflowServiceClient, error) + NewAdminClientWithTimeout(rpcAddress string, timeout time.Duration, largeTimeout time.Duration) (adminservice.AdminServiceClient, error) } // NamespaceIDToNameFunc maps a namespaceID to namespace name. Returns error when mapping is not possible. @@ -92,19 +92,19 @@ func NewRPCClientFactory( } } -func (cf *rpcClientFactory) NewHistoryClient() (history.Client, error) { +func (cf *rpcClientFactory) NewHistoryClient() (historyservice.HistoryServiceClient, error) { return cf.NewHistoryClientWithTimeout(history.DefaultTimeout) } -func (cf *rpcClientFactory) NewMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matching.Client, error) { +func (cf *rpcClientFactory) NewMatchingClient(namespaceIDToName NamespaceIDToNameFunc) (matchingservice.MatchingServiceClient, error) { return cf.NewMatchingClientWithTimeout(namespaceIDToName, matching.DefaultTimeout, matching.DefaultLongPollTimeout) } -func (cf *rpcClientFactory) NewFrontendClient(rpcAddress string) (frontend.Client, error) { +func (cf *rpcClientFactory) NewFrontendClient(rpcAddress string) (workflowservice.WorkflowServiceClient, error) { return cf.NewFrontendClientWithTimeout(rpcAddress, frontend.DefaultTimeout, frontend.DefaultLongPollTimeout) } -func (cf *rpcClientFactory) NewHistoryClientWithTimeout(timeout time.Duration) (history.Client, error) { +func (cf *rpcClientFactory) NewHistoryClientWithTimeout(timeout time.Duration) (historyservice.HistoryServiceClient, error) { resolver, err := cf.monitor.GetResolver(common.HistoryServiceName) if err != nil { return nil, err @@ -134,7 +134,7 @@ func (cf *rpcClientFactory) NewMatchingClientWithTimeout( namespaceIDToName NamespaceIDToNameFunc, timeout time.Duration, longPollTimeout time.Duration, -) (matching.Client, error) { +) (matchingservice.MatchingServiceClient, error) { resolver, err := cf.monitor.GetResolver(common.MatchingServiceName) if err != nil { return nil, err @@ -171,7 +171,7 @@ func (cf *rpcClientFactory) NewFrontendClientWithTimeout( rpcAddress string, timeout time.Duration, longPollTimeout time.Duration, -) (frontend.Client, error) { +) (workflowservice.WorkflowServiceClient, error) { keyResolver := func(key string) (string, error) { return clientKeyConnection, nil } @@ -192,7 +192,7 @@ func (cf *rpcClientFactory) NewAdminClientWithTimeout( rpcAddress string, timeout time.Duration, largeTimeout time.Duration, -) (admin.Client, error) { +) (adminservice.AdminServiceClient, error) { keyResolver := func(key string) (string, error) { return clientKeyConnection, nil } diff --git a/client/frontend/client.go b/client/frontend/client.go index 7be3c49e3c3..377fa3abbb2 100644 --- a/client/frontend/client.go +++ b/client/frontend/client.go @@ -42,7 +42,7 @@ const ( DefaultLongPollTimeout = time.Minute * 3 ) -var _ Client = (*clientImpl)(nil) +var _ workflowservice.WorkflowServiceClient = (*clientImpl)(nil) type clientImpl struct { timeout time.Duration @@ -55,7 +55,7 @@ func NewClient( timeout time.Duration, longPollTimeout time.Duration, clients common.ClientCache, -) Client { +) workflowservice.WorkflowServiceClient { return &clientImpl{ timeout: timeout, longPollTimeout: longPollTimeout, diff --git a/client/frontend/interface.go b/client/frontend/interface.go deleted file mode 100644 index f52e8043806..00000000000 --- a/client/frontend/interface.go +++ /dev/null @@ -1,34 +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 frontend - -import ( - "go.temporal.io/api/workflowservice/v1" -) - -// Client is the interface exposed by frontend service client -type Client interface { - workflowservice.WorkflowServiceClient -} diff --git a/client/frontend/metricClient.go b/client/frontend/metricClient.go index fc53503566a..874fb3e2821 100644 --- a/client/frontend/metricClient.go +++ b/client/frontend/metricClient.go @@ -33,15 +33,15 @@ import ( "go.temporal.io/server/common/metrics" ) -var _ Client = (*metricClient)(nil) +var _ workflowservice.WorkflowServiceClient = (*metricClient)(nil) type metricClient struct { - client Client + client workflowservice.WorkflowServiceClient metricsClient metrics.Client } -// NewMetricClient creates a new instance of Client that emits metrics -func NewMetricClient(client Client, metricsClient metrics.Client) Client { +// NewMetricClient creates a new instance of workflowservice.WorkflowServiceClient that emits metrics +func NewMetricClient(client workflowservice.WorkflowServiceClient, metricsClient metrics.Client) workflowservice.WorkflowServiceClient { return &metricClient{ client: client, metricsClient: metricsClient, diff --git a/client/frontend/retryableClient.go b/client/frontend/retryableClient.go index 8a70e239a80..9dae739d120 100644 --- a/client/frontend/retryableClient.go +++ b/client/frontend/retryableClient.go @@ -33,16 +33,16 @@ import ( "go.temporal.io/server/common/backoff" ) -var _ Client = (*retryableClient)(nil) +var _ workflowservice.WorkflowServiceClient = (*retryableClient)(nil) type retryableClient struct { - client Client + client workflowservice.WorkflowServiceClient policy backoff.RetryPolicy isRetryable backoff.IsRetryable } -// NewRetryableClient creates a new instance of Client with retry policy -func NewRetryableClient(client Client, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) Client { +// NewRetryableClient creates a new instance of workflowservice.WorkflowServiceClient with retry policy +func NewRetryableClient(client workflowservice.WorkflowServiceClient, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) workflowservice.WorkflowServiceClient { return &retryableClient{ client: client, policy: policy, diff --git a/client/history/client.go b/client/history/client.go index 821a1597516..d131400f8c6 100644 --- a/client/history/client.go +++ b/client/history/client.go @@ -41,7 +41,7 @@ import ( serviceerrors "go.temporal.io/server/common/serviceerror" ) -var _ Client = (*clientImpl)(nil) +var _ historyservice.HistoryServiceClient = (*clientImpl)(nil) const ( // DefaultTimeout is the default timeout used to make calls @@ -62,7 +62,7 @@ func NewClient( timeout time.Duration, clients common.ClientCache, logger log.Logger, -) Client { +) historyservice.HistoryServiceClient { return &clientImpl{ numberOfShards: numberOfShards, tokenSerializer: common.NewProtoTaskTokenSerializer(), diff --git a/client/history/interface.go b/client/history/interface.go deleted file mode 100644 index a82251ac2a2..00000000000 --- a/client/history/interface.go +++ /dev/null @@ -1,34 +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 history - -import ( - "go.temporal.io/server/api/historyservice/v1" -) - -// Client is the interface exposed by history service client -type Client interface { - historyservice.HistoryServiceClient -} diff --git a/client/history/metricClient.go b/client/history/metricClient.go index 6e66f5abe7e..e755c1cd0c0 100644 --- a/client/history/metricClient.go +++ b/client/history/metricClient.go @@ -33,15 +33,15 @@ import ( "go.temporal.io/server/common/metrics" ) -var _ Client = (*metricClient)(nil) +var _ historyservice.HistoryServiceClient = (*metricClient)(nil) type metricClient struct { - client Client + client historyservice.HistoryServiceClient metricsClient metrics.Client } -// NewMetricClient creates a new instance of Client that emits metrics -func NewMetricClient(client Client, metricsClient metrics.Client) Client { +// NewMetricClient creates a new instance of historyservice.HistoryServiceClient that emits metrics +func NewMetricClient(client historyservice.HistoryServiceClient, metricsClient metrics.Client) historyservice.HistoryServiceClient { return &metricClient{ client: client, metricsClient: metricsClient, diff --git a/client/history/retryableClient.go b/client/history/retryableClient.go index 2928e7e3154..09f3667d479 100644 --- a/client/history/retryableClient.go +++ b/client/history/retryableClient.go @@ -33,16 +33,16 @@ import ( "go.temporal.io/server/common/backoff" ) -var _ Client = (*retryableClient)(nil) +var _ historyservice.HistoryServiceClient = (*retryableClient)(nil) type retryableClient struct { - client Client + client historyservice.HistoryServiceClient policy backoff.RetryPolicy isRetryable backoff.IsRetryable } -// NewRetryableClient creates a new instance of Client with retry policy -func NewRetryableClient(client Client, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) Client { +// NewRetryableClient creates a new instance of historyservice.HistoryServiceClient with retry policy +func NewRetryableClient(client historyservice.HistoryServiceClient, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) historyservice.HistoryServiceClient { return &retryableClient{ client: client, policy: policy, diff --git a/client/matching/client.go b/client/matching/client.go index e8e405e8269..5ded9258414 100644 --- a/client/matching/client.go +++ b/client/matching/client.go @@ -35,7 +35,7 @@ import ( "go.temporal.io/server/common" ) -var _ Client = (*clientImpl)(nil) +var _ matchingservice.MatchingServiceClient = (*clientImpl)(nil) const ( // DefaultTimeout is the default timeout used to make calls @@ -57,7 +57,7 @@ func NewClient( longPollTimeout time.Duration, clients common.ClientCache, lb LoadBalancer, -) Client { +) matchingservice.MatchingServiceClient { return &clientImpl{ timeout: timeout, longPollTimeout: longPollTimeout, diff --git a/client/matching/interface.go b/client/matching/interface.go deleted file mode 100644 index 345c1b42d09..00000000000 --- a/client/matching/interface.go +++ /dev/null @@ -1,34 +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 matching - -import ( - "go.temporal.io/server/api/matchingservice/v1" -) - -// Client is the interface exposed by matching service client -type Client interface { - matchingservice.MatchingServiceClient -} diff --git a/client/matching/metricClient.go b/client/matching/metricClient.go index 3f5e47d91e4..8fad682e79d 100644 --- a/client/matching/metricClient.go +++ b/client/matching/metricClient.go @@ -35,15 +35,15 @@ import ( "go.temporal.io/server/common/metrics" ) -var _ Client = (*metricClient)(nil) +var _ matchingservice.MatchingServiceClient = (*metricClient)(nil) type metricClient struct { - client Client + client matchingservice.MatchingServiceClient metricsClient metrics.Client } -// NewMetricClient creates a new instance of Client that emits metrics -func NewMetricClient(client Client, metricsClient metrics.Client) Client { +// NewMetricClient creates a new instance of matchingservice.MatchingServiceClient that emits metrics +func NewMetricClient(client matchingservice.MatchingServiceClient, metricsClient metrics.Client) matchingservice.MatchingServiceClient { return &metricClient{ client: client, metricsClient: metricsClient, diff --git a/client/matching/retryableClient.go b/client/matching/retryableClient.go index ffe703c6d96..f0d16db2df9 100644 --- a/client/matching/retryableClient.go +++ b/client/matching/retryableClient.go @@ -33,16 +33,16 @@ import ( "go.temporal.io/server/common/backoff" ) -var _ Client = (*retryableClient)(nil) +var _ matchingservice.MatchingServiceClient = (*retryableClient)(nil) type retryableClient struct { - client Client + client matchingservice.MatchingServiceClient policy backoff.RetryPolicy isRetryable backoff.IsRetryable } -// NewRetryableClient creates a new instance of Client with retry policy -func NewRetryableClient(client Client, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) Client { +// NewRetryableClient creates a new instance of matchingservice.MatchingServiceClient with retry policy +func NewRetryableClient(client matchingservice.MatchingServiceClient, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) matchingservice.MatchingServiceClient { return &retryableClient{ client: client, policy: policy, diff --git a/common/resource/resource.go b/common/resource/resource.go index be279316b4b..86da2b52aab 100644 --- a/common/resource/resource.go +++ b/common/resource/resource.go @@ -27,13 +27,13 @@ package resource import ( "net" + "go.temporal.io/api/workflowservice/v1" sdkclient "go.temporal.io/sdk/client" + "go.temporal.io/server/api/adminservice/v1" + "go.temporal.io/server/api/historyservice/v1" + "go.temporal.io/server/api/matchingservice/v1" "go.temporal.io/server/client" - "go.temporal.io/server/client/admin" - "go.temporal.io/server/client/frontend" - "go.temporal.io/server/client/history" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common" "go.temporal.io/server/common/archiver" "go.temporal.io/server/common/archiver/provider" @@ -81,14 +81,14 @@ type ( // internal services clients GetSDKClient() sdkclient.Client - GetFrontendRawClient() frontend.Client - GetFrontendClient() frontend.Client - GetMatchingRawClient() matching.Client - GetMatchingClient() matching.Client - GetHistoryRawClient() history.Client - GetHistoryClient() history.Client - GetRemoteAdminClient(cluster string) admin.Client - GetRemoteFrontendClient(cluster string) frontend.Client + GetFrontendRawClient() workflowservice.WorkflowServiceClient + GetFrontendClient() workflowservice.WorkflowServiceClient + GetMatchingRawClient() matchingservice.MatchingServiceClient + GetMatchingClient() matchingservice.MatchingServiceClient + GetHistoryRawClient() historyservice.HistoryServiceClient + GetHistoryClient() historyservice.HistoryServiceClient + GetRemoteAdminClient(cluster string) adminservice.AdminServiceClient + GetRemoteFrontendClient(cluster string) workflowservice.WorkflowServiceClient GetClientBean() client.Bean // persistence clients diff --git a/common/resource/resourceImpl.go b/common/resource/resourceImpl.go index 001b1337a3f..9528692248b 100644 --- a/common/resource/resourceImpl.go +++ b/common/resource/resourceImpl.go @@ -33,10 +33,13 @@ import ( "github.com/uber-go/tally" "github.com/uber/tchannel-go" + "go.temporal.io/api/workflowservice/v1" sdkclient "go.temporal.io/sdk/client" + "go.temporal.io/server/api/adminservice/v1" + "go.temporal.io/server/api/historyservice/v1" + "go.temporal.io/server/api/matchingservice/v1" "go.temporal.io/server/client" - "go.temporal.io/server/client/admin" "go.temporal.io/server/client/frontend" "go.temporal.io/server/client/history" "go.temporal.io/server/client/matching" @@ -100,12 +103,12 @@ type ( // internal services clients sdkClient sdkclient.Client - frontendRawClient frontend.Client - frontendClient frontend.Client - matchingRawClient matching.Client - matchingClient matching.Client - historyRawClient history.Client - historyClient history.Client + frontendRawClient workflowservice.WorkflowServiceClient + frontendClient workflowservice.WorkflowServiceClient + matchingRawClient matchingservice.MatchingServiceClient + matchingClient matchingservice.MatchingServiceClient + historyRawClient historyservice.HistoryServiceClient + historyClient historyservice.HistoryServiceClient clientBean client.Bean // persistence clients @@ -496,39 +499,39 @@ func (h *Impl) GetSDKClient() sdkclient.Client { } // GetFrontendRawClient return frontend client without retry policy -func (h *Impl) GetFrontendRawClient() frontend.Client { +func (h *Impl) GetFrontendRawClient() workflowservice.WorkflowServiceClient { return h.frontendRawClient } // GetFrontendClient return frontend client with retry policy -func (h *Impl) GetFrontendClient() frontend.Client { +func (h *Impl) GetFrontendClient() workflowservice.WorkflowServiceClient { return h.frontendClient } // GetMatchingRawClient return matching client without retry policy -func (h *Impl) GetMatchingRawClient() matching.Client { +func (h *Impl) GetMatchingRawClient() matchingservice.MatchingServiceClient { return h.matchingRawClient } // GetMatchingClient return matching client with retry policy -func (h *Impl) GetMatchingClient() matching.Client { +func (h *Impl) GetMatchingClient() matchingservice.MatchingServiceClient { return h.matchingClient } // GetHistoryRawClient return history client without retry policy -func (h *Impl) GetHistoryRawClient() history.Client { +func (h *Impl) GetHistoryRawClient() historyservice.HistoryServiceClient { return h.historyRawClient } // GetHistoryClient return history client with retry policy -func (h *Impl) GetHistoryClient() history.Client { +func (h *Impl) GetHistoryClient() historyservice.HistoryServiceClient { return h.historyClient } // GetRemoteAdminClient return remote admin client for given cluster name func (h *Impl) GetRemoteAdminClient( cluster string, -) admin.Client { +) adminservice.AdminServiceClient { return h.clientBean.GetRemoteAdminClient(cluster) } @@ -536,7 +539,7 @@ func (h *Impl) GetRemoteAdminClient( // GetRemoteFrontendClient return remote frontend client for given cluster name func (h *Impl) GetRemoteFrontendClient( cluster string, -) frontend.Client { +) workflowservice.WorkflowServiceClient { return h.clientBean.GetRemoteFrontendClient(cluster) } diff --git a/common/resource/resourceTest.go b/common/resource/resourceTest.go index 84d39383da7..856857f9f0a 100644 --- a/common/resource/resourceTest.go +++ b/common/resource/resourceTest.go @@ -30,19 +30,19 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/mock" "github.com/uber-go/tally" + "go.temporal.io/api/workflowservice/v1" "go.temporal.io/api/workflowservicemock/v1" sdkclient "go.temporal.io/sdk/client" sdkmocks "go.temporal.io/sdk/mocks" "go.uber.org/zap" + "go.temporal.io/server/api/adminservice/v1" "go.temporal.io/server/api/adminservicemock/v1" + "go.temporal.io/server/api/historyservice/v1" "go.temporal.io/server/api/historyservicemock/v1" + "go.temporal.io/server/api/matchingservice/v1" "go.temporal.io/server/api/matchingservicemock/v1" "go.temporal.io/server/client" - "go.temporal.io/server/client/admin" - "go.temporal.io/server/client/frontend" - "go.temporal.io/server/client/history" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common" "go.temporal.io/server/common/archiver" "go.temporal.io/server/common/archiver/provider" @@ -332,39 +332,39 @@ func (s *Test) GetSDKClient() sdkclient.Client { } // GetFrontendRawClient for testing -func (s *Test) GetFrontendRawClient() frontend.Client { +func (s *Test) GetFrontendRawClient() workflowservice.WorkflowServiceClient { return s.FrontendClient } // GetFrontendClient for testing -func (s *Test) GetFrontendClient() frontend.Client { +func (s *Test) GetFrontendClient() workflowservice.WorkflowServiceClient { return s.FrontendClient } // GetMatchingRawClient for testing -func (s *Test) GetMatchingRawClient() matching.Client { +func (s *Test) GetMatchingRawClient() matchingservice.MatchingServiceClient { return s.MatchingClient } // GetMatchingClient for testing -func (s *Test) GetMatchingClient() matching.Client { +func (s *Test) GetMatchingClient() matchingservice.MatchingServiceClient { return s.MatchingClient } // GetHistoryRawClient for testing -func (s *Test) GetHistoryRawClient() history.Client { +func (s *Test) GetHistoryRawClient() historyservice.HistoryServiceClient { return s.HistoryClient } // GetHistoryClient for testing -func (s *Test) GetHistoryClient() history.Client { +func (s *Test) GetHistoryClient() historyservice.HistoryServiceClient { return s.HistoryClient } // GetRemoteAdminClient for testing func (s *Test) GetRemoteAdminClient( cluster string, -) admin.Client { +) adminservice.AdminServiceClient { return s.RemoteAdminClient } @@ -372,7 +372,7 @@ func (s *Test) GetRemoteAdminClient( // GetRemoteFrontendClient for testing func (s *Test) GetRemoteFrontendClient( cluster string, -) frontend.Client { +) workflowservice.WorkflowServiceClient { return s.RemoteFrontendClient } diff --git a/common/xdc/nDCHistoryResender.go b/common/xdc/nDCHistoryResender.go index b2d4712dded..950a9f80dc9 100644 --- a/common/xdc/nDCHistoryResender.go +++ b/common/xdc/nDCHistoryResender.go @@ -35,7 +35,6 @@ import ( "go.temporal.io/server/api/adminservice/v1" historyspb "go.temporal.io/server/api/history/v1" "go.temporal.io/server/api/historyservice/v1" - "go.temporal.io/server/client/admin" "go.temporal.io/server/common/cache" "go.temporal.io/server/common/collection" "go.temporal.io/server/common/log" @@ -71,7 +70,7 @@ type ( // NDCHistoryResenderImpl is the implementation of NDCHistoryResender NDCHistoryResenderImpl struct { namespaceCache cache.NamespaceCache - adminClient admin.Client + adminClient adminservice.AdminServiceClient historyReplicationFn nDCHistoryReplicationFn serializer persistence.PayloadSerializer rereplicationTimeout dynamicconfig.DurationPropertyFnWithNamespaceIDFilter @@ -91,7 +90,7 @@ const ( // NewNDCHistoryResender create a new NDCHistoryResenderImpl func NewNDCHistoryResender( namespaceCache cache.NamespaceCache, - adminClient admin.Client, + adminClient adminservice.AdminServiceClient, historyReplicationFn nDCHistoryReplicationFn, serializer persistence.PayloadSerializer, rereplicationTimeout dynamicconfig.DurationPropertyFnWithNamespaceIDFilter, diff --git a/host/ndc/ndc_integration_test.go b/host/ndc/ndc_integration_test.go index 1e399a42070..b43c1ba324e 100644 --- a/host/ndc/ndc_integration_test.go +++ b/host/ndc/ndc_integration_test.go @@ -61,7 +61,6 @@ import ( "go.temporal.io/server/api/adminservice/v1" "go.temporal.io/server/api/adminservicemock/v1" "go.temporal.io/server/api/historyservice/v1" - adminClient "go.temporal.io/server/client/admin" "go.temporal.io/server/common" "go.temporal.io/server/common/cache" "go.temporal.io/server/common/log" @@ -88,7 +87,7 @@ type ( namespaceID string version int64 versionIncrement int64 - mockAdminClient map[string]adminClient.Client + mockAdminClient map[string]adminservice.AdminServiceClient standByReplicationTasksChan chan *replicationspb.ReplicationTask standByTaskID int64 } @@ -134,7 +133,7 @@ func (s *nDCIntegrationTestSuite) SetupSuite() { s.standByReplicationTasksChan = make(chan *replicationspb.ReplicationTask, 100) s.standByTaskID = 0 - s.mockAdminClient = make(map[string]adminClient.Client) + s.mockAdminClient = make(map[string]adminservice.AdminServiceClient) controller := gomock.NewController(s.T()) mockStandbyClient := adminservicemock.NewMockAdminServiceClient(controller) mockStandbyClient.EXPECT().GetReplicationMessages(gomock.Any(), gomock.Any()).DoAndReturn(s.GetReplicationMessagesMock).AnyTimes() diff --git a/host/onebox.go b/host/onebox.go index b9b59a0b389..60fe13f3046 100644 --- a/host/onebox.go +++ b/host/onebox.go @@ -39,7 +39,6 @@ import ( "go.temporal.io/server/api/adminservice/v1" "go.temporal.io/server/api/historyservice/v1" - adminClient "go.temporal.io/server/client/admin" "go.temporal.io/server/common" carchiver "go.temporal.io/server/common/archiver" "go.temporal.io/server/common/archiver/provider" @@ -112,7 +111,7 @@ type ( esConfig *elasticsearch.Config esClient elasticsearch.Client workerConfig *WorkerConfig - mockAdminClient map[string]adminClient.Client + mockAdminClient map[string]adminservice.AdminServiceClient namespaceReplicationTaskExecutor namespace.ReplicationTaskExecutor } @@ -145,7 +144,7 @@ type ( ESConfig *elasticsearch.Config ESClient elasticsearch.Client WorkerConfig *WorkerConfig - MockAdminClient map[string]adminClient.Client + MockAdminClient map[string]adminservice.AdminServiceClient NamespaceReplicationTaskExecutor namespace.ReplicationTaskExecutor } diff --git a/host/testcluster.go b/host/testcluster.go index 0ed529f86df..dd0fef8be28 100644 --- a/host/testcluster.go +++ b/host/testcluster.go @@ -33,7 +33,7 @@ import ( "github.com/uber-go/tally" "go.uber.org/zap" - adminClient "go.temporal.io/server/client/admin" + "go.temporal.io/server/api/adminservice/v1" "go.temporal.io/server/common" "go.temporal.io/server/common/archiver" "go.temporal.io/server/common/archiver/filestore" @@ -85,7 +85,7 @@ type ( HistoryConfig *HistoryConfig ESConfig *elasticsearch.Config WorkerConfig *WorkerConfig - MockAdminClient map[string]adminClient.Client + MockAdminClient map[string]adminservice.AdminServiceClient } // MessagingClientConfig is the config for messaging config diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index 4c4ff01e96d..77d12a71c6c 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -51,7 +51,6 @@ import ( workflowspb "go.temporal.io/server/api/workflow/v1" "go.temporal.io/server/client/admin" "go.temporal.io/server/client/history" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common" "go.temporal.io/server/common/cache" "go.temporal.io/server/common/clock" @@ -113,8 +112,8 @@ type ( replicationTaskProcessors []ReplicationTaskProcessor publicClient sdkclient.Client eventsReapplier nDCEventsReapplier - matchingClient matching.Client - rawMatchingClient matching.Client + matchingClient matchingservice.MatchingServiceClient + rawMatchingClient matchingservice.MatchingServiceClient replicationDLQHandler replicationDLQHandler searchAttributesValidator *validator.SearchAttributesValidator } @@ -174,13 +173,13 @@ var ( func NewEngineWithShardContext( shard shard.Context, visibilityMgr persistence.VisibilityManager, - matching matching.Client, - historyClient history.Client, + matching matchingservice.MatchingServiceClient, + historyClient historyservice.HistoryServiceClient, publicClient sdkclient.Client, eventNotifier events.Notifier, config *configs.Config, replicationTaskFetchers ReplicationTaskFetchers, - rawMatchingClient matching.Client, + rawMatchingClient matchingservice.MatchingServiceClient, queueTaskProcessor queueTaskProcessor, ) *historyEngineImpl { currentClusterName := shard.GetService().GetClusterMetadata().GetCurrentClusterName() diff --git a/service/history/nDCStandbyTaskUtil.go b/service/history/nDCStandbyTaskUtil.go index 199cbeb8da6..2dd9bfff02f 100644 --- a/service/history/nDCStandbyTaskUtil.go +++ b/service/history/nDCStandbyTaskUtil.go @@ -33,7 +33,6 @@ import ( "go.temporal.io/server/api/adminservice/v1" persistencespb "go.temporal.io/server/api/persistence/v1" - "go.temporal.io/server/client/admin" "go.temporal.io/server/common/cache" "go.temporal.io/server/common/log" "go.temporal.io/server/common/log/tag" @@ -202,7 +201,7 @@ func getStandbyPostActionFn( } func refreshTasks( - adminClient admin.Client, + adminClient adminservice.AdminServiceClient, namespaceCache cache.NamespaceCache, namespaceID string, workflowID string, diff --git a/service/history/replicationTaskFetcher.go b/service/history/replicationTaskFetcher.go index f01fb0edaad..64915989619 100644 --- a/service/history/replicationTaskFetcher.go +++ b/service/history/replicationTaskFetcher.go @@ -33,7 +33,6 @@ import ( "go.temporal.io/server/api/adminservice/v1" replicationspb "go.temporal.io/server/api/replication/v1" "go.temporal.io/server/client" - "go.temporal.io/server/client/admin" "go.temporal.io/server/common" "go.temporal.io/server/common/backoff" "go.temporal.io/server/common/cluster" @@ -82,7 +81,7 @@ type ( config *configs.Config numWorker int logger log.Logger - remotePeer admin.Client + remotePeer adminservice.AdminServiceClient rateLimiter quotas.RateLimiter requestChan chan *replicationTaskRequest shutdownChan chan struct{} @@ -96,7 +95,7 @@ type ( sourceCluster string config *configs.Config logger log.Logger - remotePeer admin.Client + remotePeer adminservice.AdminServiceClient rateLimiter quotas.RateLimiter requestChan chan *replicationTaskRequest shutdownChan chan struct{} @@ -183,7 +182,7 @@ func newReplicationTaskFetcher( sourceCluster string, currentCluster string, config *configs.Config, - sourceFrontend admin.Client, + sourceFrontend adminservice.AdminServiceClient, ) *ReplicationTaskFetcherImpl { numWorker := config.ReplicationTaskFetcherParallelism() requestChan := make(chan *replicationTaskRequest, requestChanBufferSize) @@ -274,7 +273,7 @@ func newReplicationTaskFetcherWorker( sourceCluster string, currentCluster string, config *configs.Config, - sourceFrontend admin.Client, + sourceFrontend adminservice.AdminServiceClient, rateLimiter quotas.RateLimiter, requestChan chan *replicationTaskRequest, shutdownChan chan struct{}, diff --git a/service/history/timerQueueActiveProcessor.go b/service/history/timerQueueActiveProcessor.go index 962d5a596b8..55788e0ef50 100644 --- a/service/history/timerQueueActiveProcessor.go +++ b/service/history/timerQueueActiveProcessor.go @@ -29,8 +29,8 @@ import ( "github.com/pborman/uuid" + "go.temporal.io/server/api/matchingservice/v1" persistencespb "go.temporal.io/server/api/persistence/v1" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common/collection" "go.temporal.io/server/common/log" "go.temporal.io/server/common/log/tag" @@ -55,7 +55,7 @@ type ( func newTimerQueueActiveProcessor( shard shard.Context, historyService *historyEngineImpl, - matchingClient matching.Client, + matchingClient matchingservice.MatchingServiceClient, taskAllocator taskAllocator, queueTaskProcessor queueTaskProcessor, logger log.Logger, @@ -149,7 +149,7 @@ func newTimerQueueFailoverProcessor( standbyClusterName string, minLevel time.Time, maxLevel time.Time, - matchingClient matching.Client, + matchingClient matchingservice.MatchingServiceClient, taskAllocator taskAllocator, queueTaskProcessor queueTaskProcessor, logger log.Logger, diff --git a/service/history/timerQueueProcessor.go b/service/history/timerQueueProcessor.go index 815140668a3..f438973e3d8 100644 --- a/service/history/timerQueueProcessor.go +++ b/service/history/timerQueueProcessor.go @@ -35,7 +35,7 @@ import ( "time" "go.temporal.io/server/api/historyservice/v1" - "go.temporal.io/server/client/matching" + "go.temporal.io/server/api/matchingservice/v1" "go.temporal.io/server/common" "go.temporal.io/server/common/log" "go.temporal.io/server/common/log/tag" @@ -72,7 +72,7 @@ type ( historyService *historyEngineImpl ackLevel timerKey logger log.Logger - matchingClient matching.Client + matchingClient matchingservice.MatchingServiceClient status int32 shutdownChan chan struct{} shutdownWG sync.WaitGroup @@ -85,7 +85,7 @@ type ( func newTimerQueueProcessor( shard shard.Context, historyService *historyEngineImpl, - matchingClient matching.Client, + matchingClient matchingservice.MatchingServiceClient, queueTaskProcessor queueTaskProcessor, logger log.Logger, ) timerQueueProcessor { diff --git a/service/history/timerQueueStandbyTaskExecutor.go b/service/history/timerQueueStandbyTaskExecutor.go index 6900aa6292a..71973354a10 100644 --- a/service/history/timerQueueStandbyTaskExecutor.go +++ b/service/history/timerQueueStandbyTaskExecutor.go @@ -31,9 +31,9 @@ import ( enumspb "go.temporal.io/api/enums/v1" "go.temporal.io/api/serviceerror" + "go.temporal.io/server/api/adminservice/v1" enumsspb "go.temporal.io/server/api/enums/v1" persistencespb "go.temporal.io/server/api/persistence/v1" - "go.temporal.io/server/client/admin" "go.temporal.io/server/common" "go.temporal.io/server/common/clock" "go.temporal.io/server/common/log" @@ -50,7 +50,7 @@ type ( *timerQueueTaskExecutorBase clusterName string - adminClient admin.Client + adminClient adminservice.AdminServiceClient nDCHistoryResender xdc.NDCHistoryResender } ) diff --git a/service/history/transferQueueActiveProcessor.go b/service/history/transferQueueActiveProcessor.go index bea68070072..85ba9bf67db 100644 --- a/service/history/transferQueueActiveProcessor.go +++ b/service/history/transferQueueActiveProcessor.go @@ -27,9 +27,9 @@ package history import ( "github.com/pborman/uuid" + "go.temporal.io/server/api/historyservice/v1" + "go.temporal.io/server/api/matchingservice/v1" persistencespb "go.temporal.io/server/api/persistence/v1" - "go.temporal.io/server/client/history" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common/collection" "go.temporal.io/server/common/log" "go.temporal.io/server/common/log/tag" @@ -59,8 +59,8 @@ func newTransferQueueActiveProcessor( shard shard.Context, historyService *historyEngineImpl, visibilityMgr persistence.VisibilityManager, - matchingClient matching.Client, - historyClient history.Client, + matchingClient matchingservice.MatchingServiceClient, + historyClient historyservice.HistoryServiceClient, taskAllocator taskAllocator, queueTaskProcessor queueTaskProcessor, logger log.Logger, @@ -175,8 +175,8 @@ func newTransferQueueFailoverProcessor( shard shard.Context, historyService *historyEngineImpl, visibilityMgr persistence.VisibilityManager, - matchingClient matching.Client, - historyClient history.Client, + matchingClient matchingservice.MatchingServiceClient, + historyClient historyservice.HistoryServiceClient, namespaceIDs map[string]struct{}, standbyClusterName string, minLevel int64, diff --git a/service/history/transferQueueActiveTaskExecutor.go b/service/history/transferQueueActiveTaskExecutor.go index d4c364e8c5f..d0932e2e76d 100644 --- a/service/history/transferQueueActiveTaskExecutor.go +++ b/service/history/transferQueueActiveTaskExecutor.go @@ -42,7 +42,6 @@ import ( "go.temporal.io/server/api/historyservice/v1" persistencespb "go.temporal.io/server/api/persistence/v1" workflowspb "go.temporal.io/server/api/workflow/v1" - "go.temporal.io/server/client/history" "go.temporal.io/server/common" "go.temporal.io/server/common/backoff" "go.temporal.io/server/common/log" @@ -60,7 +59,7 @@ type ( transferQueueActiveTaskExecutor struct { *transferQueueTaskExecutorBase - historyClient history.Client + historyClient historyservice.HistoryServiceClient parentClosePolicyClient parentclosepolicy.Client } ) diff --git a/service/history/transferQueueProcessor.go b/service/history/transferQueueProcessor.go index f2bdd95e49e..7499d105bbd 100644 --- a/service/history/transferQueueProcessor.go +++ b/service/history/transferQueueProcessor.go @@ -34,8 +34,7 @@ import ( "time" "go.temporal.io/server/api/historyservice/v1" - "go.temporal.io/server/client/history" - "go.temporal.io/server/client/matching" + "go.temporal.io/server/api/matchingservice/v1" "go.temporal.io/server/common" "go.temporal.io/server/common/log" "go.temporal.io/server/common/log/tag" @@ -70,8 +69,8 @@ type ( metricsClient metrics.Client historyService *historyEngineImpl visibilityMgr persistence.VisibilityManager - matchingClient matching.Client - historyClient history.Client + matchingClient matchingservice.MatchingServiceClient + historyClient historyservice.HistoryServiceClient ackLevel int64 logger log.Logger isStarted int32 @@ -87,8 +86,8 @@ func newTransferQueueProcessor( shard shard.Context, historyService *historyEngineImpl, visibilityMgr persistence.VisibilityManager, - matchingClient matching.Client, - historyClient history.Client, + matchingClient matchingservice.MatchingServiceClient, + historyClient historyservice.HistoryServiceClient, queueTaskProcessor queueTaskProcessor, logger log.Logger, ) *transferQueueProcessorImpl { diff --git a/service/history/transferQueueStandbyProcessor.go b/service/history/transferQueueStandbyProcessor.go index 92c7b1c1e73..ddf5a6fa5c9 100644 --- a/service/history/transferQueueStandbyProcessor.go +++ b/service/history/transferQueueStandbyProcessor.go @@ -25,8 +25,8 @@ package history import ( + "go.temporal.io/server/api/matchingservice/v1" persistencespb "go.temporal.io/server/api/persistence/v1" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common/collection" "go.temporal.io/server/common/log" "go.temporal.io/server/common/log/tag" @@ -58,7 +58,7 @@ func newTransferQueueStandbyProcessor( shard shard.Context, historyService *historyEngineImpl, visibilityMgr persistence.VisibilityManager, - matchingClient matching.Client, + matchingClient matchingservice.MatchingServiceClient, taskAllocator taskAllocator, nDCHistoryResender xdc.NDCHistoryResender, queueTaskProcessor queueTaskProcessor, diff --git a/service/history/transferQueueStandbyTaskExecutor.go b/service/history/transferQueueStandbyTaskExecutor.go index 421262bf2e9..64ea8367c4e 100644 --- a/service/history/transferQueueStandbyTaskExecutor.go +++ b/service/history/transferQueueStandbyTaskExecutor.go @@ -31,9 +31,9 @@ import ( "go.temporal.io/api/serviceerror" taskqueuepb "go.temporal.io/api/taskqueue/v1" + "go.temporal.io/server/api/adminservice/v1" enumsspb "go.temporal.io/server/api/enums/v1" persistencespb "go.temporal.io/server/api/persistence/v1" - "go.temporal.io/server/client/admin" "go.temporal.io/server/common" "go.temporal.io/server/common/log" "go.temporal.io/server/common/log/tag" @@ -49,7 +49,7 @@ type ( *transferQueueTaskExecutorBase clusterName string - adminClient admin.Client + adminClient adminservice.AdminServiceClient nDCHistoryResender xdc.NDCHistoryResender } ) diff --git a/service/history/transferQueueTaskExecutorBase.go b/service/history/transferQueueTaskExecutorBase.go index 30d1b79f1e7..ff82373fc37 100644 --- a/service/history/transferQueueTaskExecutorBase.go +++ b/service/history/transferQueueTaskExecutorBase.go @@ -34,9 +34,9 @@ import ( taskqueuepb "go.temporal.io/api/taskqueue/v1" enumsspb "go.temporal.io/server/api/enums/v1" + "go.temporal.io/server/api/matchingservice/v1" m "go.temporal.io/server/api/matchingservice/v1" persistencespb "go.temporal.io/server/api/persistence/v1" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common" "go.temporal.io/server/common/log" "go.temporal.io/server/common/log/tag" @@ -60,7 +60,7 @@ type ( cache *historyCache logger log.Logger metricsClient metrics.Client - matchingClient matching.Client + matchingClient matchingservice.MatchingServiceClient visibilityMgr persistence.VisibilityManager config *configs.Config } diff --git a/service/history/visibilityQueueProcessor.go b/service/history/visibilityQueueProcessor.go index 15b72ff2f08..797db0e45f5 100644 --- a/service/history/visibilityQueueProcessor.go +++ b/service/history/visibilityQueueProcessor.go @@ -30,8 +30,8 @@ import ( "time" enumsspb "go.temporal.io/server/api/enums/v1" - "go.temporal.io/server/client/history" - "go.temporal.io/server/client/matching" + "go.temporal.io/server/api/historyservice/v1" + "go.temporal.io/server/api/matchingservice/v1" "go.temporal.io/server/common" "go.temporal.io/server/common/collection" "go.temporal.io/server/common/log" @@ -70,8 +70,8 @@ type ( config *configs.Config historyService *historyEngineImpl visibilityMgr persistence.VisibilityManager - matchingClient matching.Client - historyClient history.Client + matchingClient matchingservice.MatchingServiceClient + historyClient historyservice.HistoryServiceClient ackLevel int64 queueTaskProcessor queueTaskProcessor @@ -85,8 +85,8 @@ func newVisibilityQueueProcessor( shard shard.Context, historyService *historyEngineImpl, visibilityMgr persistence.VisibilityManager, - matchingClient matching.Client, - historyClient history.Client, + matchingClient matchingservice.MatchingServiceClient, + historyClient historyservice.HistoryServiceClient, queueTaskProcessor queueTaskProcessor, logger log.Logger, ) *visibilityQueueProcessorImpl { diff --git a/service/history/visibilityQueueTaskExecutor.go b/service/history/visibilityQueueTaskExecutor.go index bd8cf55cd71..fbd79a02150 100644 --- a/service/history/visibilityQueueTaskExecutor.go +++ b/service/history/visibilityQueueTaskExecutor.go @@ -35,9 +35,9 @@ import ( "go.temporal.io/api/serviceerror" enumsspb "go.temporal.io/server/api/enums/v1" + "go.temporal.io/server/api/historyservice/v1" + "go.temporal.io/server/api/matchingservice/v1" persistencespb "go.temporal.io/server/api/persistence/v1" - "go.temporal.io/server/client/history" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common" "go.temporal.io/server/common/backoff" "go.temporal.io/server/common/log" @@ -56,10 +56,10 @@ type ( cache *historyCache logger log.Logger metricsClient metrics.Client - matchingClient matching.Client + matchingClient matchingservice.MatchingServiceClient visibilityMgr persistence.VisibilityManager config *configs.Config - historyClient history.Client + historyClient historyservice.HistoryServiceClient parentClosePolicyClient parentclosepolicy.Client } ) diff --git a/service/matching/forwarder.go b/service/matching/forwarder.go index 9cab53f139b..3950cfecafc 100644 --- a/service/matching/forwarder.go +++ b/service/matching/forwarder.go @@ -36,7 +36,6 @@ import ( "go.temporal.io/api/workflowservice/v1" "go.temporal.io/server/api/matchingservice/v1" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common/primitives/timestamp" "go.temporal.io/server/common/quotas" ) @@ -48,7 +47,7 @@ type ( cfg *forwarderConfig taskQueueID *taskQueueID taskQueueKind enumspb.TaskQueueKind - client matching.Client + client matchingservice.MatchingServiceClient // token channels that vend tokens necessary to make // API calls exposed by forwarder. Tokens are used @@ -100,7 +99,7 @@ func newForwarder( cfg *forwarderConfig, taskQueueID *taskQueueID, kind enumspb.TaskQueueKind, - client matching.Client, + client matchingservice.MatchingServiceClient, ) *Forwarder { fwdr := &Forwarder{ cfg: cfg, diff --git a/service/matching/matchingEngine.go b/service/matching/matchingEngine.go index 6ad6d42186c..338285cf664 100644 --- a/service/matching/matchingEngine.go +++ b/service/matching/matchingEngine.go @@ -43,8 +43,6 @@ import ( "go.temporal.io/server/api/matchingservice/v1" persistencespb "go.temporal.io/server/api/persistence/v1" tokenspb "go.temporal.io/server/api/token/v1" - "go.temporal.io/server/client/history" - "go.temporal.io/server/client/matching" "go.temporal.io/server/common" "go.temporal.io/server/common/backoff" "go.temporal.io/server/common/cache" @@ -75,8 +73,8 @@ type ( matchingEngineImpl struct { taskManager persistence.TaskManager - historyService history.Client - matchingClient matching.Client + historyService historyservice.HistoryServiceClient + matchingClient matchingservice.MatchingServiceClient tokenSerializer common.TaskTokenSerializer logger log.Logger metricsClient metrics.Client @@ -109,8 +107,8 @@ var _ Engine = (*matchingEngineImpl)(nil) // Asserts that interface is indeed im // NewEngine creates an instance of matching engine func NewEngine(taskManager persistence.TaskManager, - historyService history.Client, - matchingClient matching.Client, + historyService historyservice.HistoryServiceClient, + matchingClient matchingservice.MatchingServiceClient, config *Config, logger log.Logger, metricsClient metrics.Client, diff --git a/service/matching/matchingEngine_test.go b/service/matching/matchingEngine_test.go index 2d71f43eb3b..033572c02c0 100644 --- a/service/matching/matchingEngine_test.go +++ b/service/matching/matchingEngine_test.go @@ -53,7 +53,6 @@ import ( "go.temporal.io/server/api/matchingservice/v1" persistencespb "go.temporal.io/server/api/persistence/v1" tokenspb "go.temporal.io/server/api/token/v1" - "go.temporal.io/server/client/history" "go.temporal.io/server/common" "go.temporal.io/server/common/cache" "go.temporal.io/server/common/log" @@ -134,7 +133,7 @@ func (s *matchingEngineSuite) newMatchingEngine( } func newMatchingEngine( - config *Config, taskMgr persistence.TaskManager, mockHistoryClient history.Client, + config *Config, taskMgr persistence.TaskManager, mockHistoryClient historyservice.HistoryServiceClient, logger log.Logger, mockNamespaceCache cache.NamespaceCache, ) *matchingEngineImpl { return &matchingEngineImpl{ diff --git a/service/worker/batcher/workflow.go b/service/worker/batcher/workflow.go index eef89618fb0..ef007a76931 100644 --- a/service/worker/batcher/workflow.go +++ b/service/worker/batcher/workflow.go @@ -38,7 +38,6 @@ import ( "go.temporal.io/sdk/workflow" "golang.org/x/time/rate" - "go.temporal.io/server/client/frontend" "go.temporal.io/server/common/convert" "go.temporal.io/server/common/log" "go.temporal.io/server/common/log/tag" @@ -328,7 +327,7 @@ func startTaskProcessor( taskCh chan taskDetail, respCh chan error, limiter *rate.Limiter, - client frontend.Client, + client workflowservice.WorkflowServiceClient, ) { batcher := ctx.Value(batcherContextKey).(*Batcher) for { @@ -415,7 +414,7 @@ func processTask( limiter *rate.Limiter, task taskDetail, batchParams BatchParams, - client frontend.Client, + client workflowservice.WorkflowServiceClient, applyOnChild *bool, procFn func(string, string) error, ) error { diff --git a/service/worker/replicator/namespace_replication_message_processor.go b/service/worker/replicator/namespace_replication_message_processor.go index 319eaaa7d91..db71a202c4a 100644 --- a/service/worker/replicator/namespace_replication_message_processor.go +++ b/service/worker/replicator/namespace_replication_message_processor.go @@ -32,7 +32,6 @@ import ( "go.temporal.io/server/api/adminservice/v1" replicationspb "go.temporal.io/server/api/replication/v1" - "go.temporal.io/server/client/admin" "go.temporal.io/server/common" "go.temporal.io/server/common/backoff" "go.temporal.io/server/common/log" @@ -56,7 +55,7 @@ const ( func newNamespaceReplicationMessageProcessor( sourceCluster string, logger log.Logger, - remotePeer admin.Client, + remotePeer adminservice.AdminServiceClient, metricsClient metrics.Client, taskExecutor namespace.ReplicationTaskExecutor, hostInfo *membership.HostInfo, @@ -91,7 +90,7 @@ type ( status int32 sourceCluster string logger log.Logger - remotePeer admin.Client + remotePeer adminservice.AdminServiceClient taskExecutor namespace.ReplicationTaskExecutor metricsClient metrics.Client retryPolicy backoff.RetryPolicy diff --git a/service/worker/scanner/executions/scavenger.go b/service/worker/scanner/executions/scavenger.go index f5f2a69b46f..5b8fae2f8db 100644 --- a/service/worker/scanner/executions/scavenger.go +++ b/service/worker/scanner/executions/scavenger.go @@ -30,7 +30,7 @@ import ( "sync/atomic" "time" - "go.temporal.io/server/client/frontend" + "go.temporal.io/api/workflowservice/v1" "go.temporal.io/server/common/log/tag" "go.temporal.io/server/common/quotas" @@ -44,7 +44,7 @@ import ( type ( // Scavenger is the type that holds the state for executions scavenger daemon Scavenger struct { - frontendClient frontend.Client // used to query visibility + frontendClient workflowservice.WorkflowServiceClient // used to query visibility historyDB persistence.HistoryManager numHistoryShards int32 executor executor.Executor @@ -94,7 +94,7 @@ var ( // - either all executions are processed successfully (or) // - Stop() method is called to stop the scavenger func NewScavenger( - frontendClient frontend.Client, + frontendClient workflowservice.WorkflowServiceClient, historyDB persistence.HistoryManager, metricsClient metrics.Client, logger log.Logger, diff --git a/service/worker/scanner/executions/scavenger_test.go b/service/worker/scanner/executions/scavenger_test.go index ac3e99f85ef..cb7100f8571 100644 --- a/service/worker/scanner/executions/scavenger_test.go +++ b/service/worker/scanner/executions/scavenger_test.go @@ -29,7 +29,7 @@ import ( "github.com/stretchr/testify/suite" - "go.temporal.io/server/client/frontend" + "go.temporal.io/api/workflowservice/v1" "go.temporal.io/server/common/log" "go.temporal.io/server/common/metrics" "go.temporal.io/server/common/persistence" @@ -47,7 +47,7 @@ func TestScavengerTestSuite(t *testing.T) { } func (s *ScavengerTestSuite) TestShardValidatorInitializedWithProperValues() { - var frontendClient frontend.Client + var frontendClient workflowservice.WorkflowServiceClient var historyDB persistence.HistoryManager var metricsClient metrics.Client var logger log.Logger