From f77e2e349cd8a7b860f394006f985619339666da Mon Sep 17 00:00:00 2001 From: Edward Liang Date: Wed, 22 Jan 2025 13:41:20 -0800 Subject: [PATCH] Renamed interfaces to be more informative Signed-off-by: Edward Liang --- go/api/base_client.go | 2 +- go/api/glide_client.go | 10 +++++----- go/api/glide_cluster_client.go | 10 +++++----- go/integTest/glide_test_suite_test.go | 12 ++++++------ go/integTest/shared_commands_test.go | 22 +++++++++++----------- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/go/api/base_client.go b/go/api/base_client.go index eb7f4096c7..33eecc93e3 100644 --- a/go/api/base_client.go +++ b/go/api/base_client.go @@ -22,7 +22,7 @@ import ( "google.golang.org/protobuf/proto" ) -// BaseClient defines an interface for methods common to both [IGlideClient] and [IGlideClusterClient]. +// BaseClient defines an interface for methods common to both [GlideClientCommands] and [GlideClusterClientCommands]. type BaseClient interface { StringCommands HashCommands diff --git a/go/api/glide_client.go b/go/api/glide_client.go index 985cf9b070..60fe085cc7 100644 --- a/go/api/glide_client.go +++ b/go/api/glide_client.go @@ -11,10 +11,10 @@ import ( ) // GlideClient interface compliance check. -var _ IGlideClient = (*GlideClient)(nil) +var _ GlideClientCommands = (*GlideClient)(nil) -// IGlideClient is a client used for connection in Standalone mode. -type IGlideClient interface { +// GlideClientCommands is a client used for connection in Standalone mode. +type GlideClientCommands interface { BaseClient GenericCommands ServerManagementCommands @@ -25,8 +25,8 @@ type GlideClient struct { *baseClient } -// NewGlideClient creates a [IGlideClient] in standalone mode using the given [GlideClientConfiguration]. -func NewGlideClient(config *GlideClientConfiguration) (IGlideClient, error) { +// NewGlideClient creates a [GlideClientCommands] in standalone mode using the given [GlideClientConfiguration]. +func NewGlideClient(config *GlideClientConfiguration) (GlideClientCommands, error) { client, err := createClient(config) if err != nil { return nil, err diff --git a/go/api/glide_cluster_client.go b/go/api/glide_cluster_client.go index 7486487717..42d80db068 100644 --- a/go/api/glide_cluster_client.go +++ b/go/api/glide_cluster_client.go @@ -7,10 +7,10 @@ package api import "C" // GlideClusterClient interface compliance check. -var _ IGlideClusterClient = (*GlideClusterClient)(nil) +var _ GlideClusterClientCommands = (*GlideClusterClient)(nil) -// IGlideClusterClient is a client used for connection in cluster mode. -type IGlideClusterClient interface { +// GlideClusterClientCommands is a client used for connection in cluster mode. +type GlideClusterClientCommands interface { BaseClient GenericClusterCommands } @@ -20,8 +20,8 @@ type GlideClusterClient struct { *baseClient } -// NewGlideClusterClient creates a [IGlideClusterClient] in cluster mode using the given [GlideClusterClientConfiguration]. -func NewGlideClusterClient(config *GlideClusterClientConfiguration) (IGlideClusterClient, error) { +// NewGlideClusterClient creates a [GlideClusterClientCommands] in cluster mode using the given [GlideClusterClientConfiguration]. +func NewGlideClusterClient(config *GlideClusterClientConfiguration) (GlideClusterClientCommands, error) { client, err := createClient(config) if err != nil { return nil, err diff --git a/go/integTest/glide_test_suite_test.go b/go/integTest/glide_test_suite_test.go index cbce0ed3ef..10532b0520 100644 --- a/go/integTest/glide_test_suite_test.go +++ b/go/integTest/glide_test_suite_test.go @@ -24,8 +24,8 @@ type GlideTestSuite struct { clusterHosts []api.NodeAddress tls bool serverVersion string - clients []api.IGlideClient - clusterClients []api.IGlideClusterClient + clients []api.GlideClientCommands + clusterClients []api.GlideClusterClientCommands } var ( @@ -227,7 +227,7 @@ func (suite *GlideTestSuite) getDefaultClients() []api.BaseClient { return []api.BaseClient{suite.defaultClient(), suite.defaultClusterClient()} } -func (suite *GlideTestSuite) defaultClient() api.IGlideClient { +func (suite *GlideTestSuite) defaultClient() api.GlideClientCommands { config := api.NewGlideClientConfiguration(). WithAddress(&suite.standaloneHosts[0]). WithUseTLS(suite.tls). @@ -235,7 +235,7 @@ func (suite *GlideTestSuite) defaultClient() api.IGlideClient { return suite.client(config) } -func (suite *GlideTestSuite) client(config *api.GlideClientConfiguration) api.IGlideClient { +func (suite *GlideTestSuite) client(config *api.GlideClientConfiguration) api.GlideClientCommands { client, err := api.NewGlideClient(config) assert.Nil(suite.T(), err) @@ -245,7 +245,7 @@ func (suite *GlideTestSuite) client(config *api.GlideClientConfiguration) api.IG return client } -func (suite *GlideTestSuite) defaultClusterClient() api.IGlideClusterClient { +func (suite *GlideTestSuite) defaultClusterClient() api.GlideClusterClientCommands { config := api.NewGlideClusterClientConfiguration(). WithAddress(&suite.clusterHosts[0]). WithUseTLS(suite.tls). @@ -253,7 +253,7 @@ func (suite *GlideTestSuite) defaultClusterClient() api.IGlideClusterClient { return suite.clusterClient(config) } -func (suite *GlideTestSuite) clusterClient(config *api.GlideClusterClientConfiguration) api.IGlideClusterClient { +func (suite *GlideTestSuite) clusterClient(config *api.GlideClusterClientConfiguration) api.GlideClusterClientCommands { client, err := api.NewGlideClusterClient(config) assert.Nil(suite.T(), err) diff --git a/go/integTest/shared_commands_test.go b/go/integTest/shared_commands_test.go index 12ceecebd5..bfc63fc3b8 100644 --- a/go/integTest/shared_commands_test.go +++ b/go/integTest/shared_commands_test.go @@ -4170,9 +4170,9 @@ func sendWithCustomCommand(suite *GlideTestSuite, client api.BaseClient, args [] var res any var err error switch c := client.(type) { - case api.IGlideClient: + case api.GlideClientCommands: res, err = c.CustomCommand(args) - case api.IGlideClusterClient: + case api.GlideClusterClientCommands: res, err = c.CustomCommand(args) default: suite.FailNow(errMsg) @@ -4468,7 +4468,7 @@ func (suite *GlideTestSuite) TestXRead() { // ensure that commands doesn't time out even if timeout > request timeout var testClient api.BaseClient - if _, ok := client.(api.IGlideClient); ok { + if _, ok := client.(api.GlideClientCommands); ok { testClient = suite.client(api.NewGlideClientConfiguration(). WithAddress(&suite.standaloneHosts[0]). WithUseTLS(suite.tls)) @@ -5572,7 +5572,7 @@ func (suite *GlideTestSuite) TestXPending() { // each use of CustomCommand would make the tests difficult to read and maintain. These tests can be // collapsed once the native commands are added in a subsequent release. - execStandalone := func(client api.IGlideClient) { + execStandalone := func(client api.GlideClientCommands) { // 1. Arrange the data key := uuid.New().String() groupName := "group" + uuid.New().String() @@ -5646,7 +5646,7 @@ func (suite *GlideTestSuite) TestXPending() { assert.Equal(suite.T(), streamid_2.Value(), detailResult[1].Id) } - execCluster := func(client api.IGlideClusterClient) { + execCluster := func(client api.GlideClusterClientCommands) { // 1. Arrange the data key := uuid.New().String() groupName := "group" + uuid.New().String() @@ -5728,9 +5728,9 @@ func (suite *GlideTestSuite) TestXPending() { // this is only needed in order to be able to use custom commands. // Once the native commands are added, this logic will be refactored. switch c := client.(type) { - case api.IGlideClient: + case api.GlideClientCommands: execStandalone(c) - case api.IGlideClusterClient: + case api.GlideClusterClientCommands: execCluster(c) } }) @@ -5746,7 +5746,7 @@ func (suite *GlideTestSuite) TestXPendingFailures() { // each use of CustomCommand would make the tests difficult to read and maintain. These tests can be // collapsed once the native commands are added in a subsequent release. - execStandalone := func(client api.IGlideClient) { + execStandalone := func(client api.GlideClientCommands) { // 1. Arrange the data key := uuid.New().String() missingKey := uuid.New().String() @@ -5896,7 +5896,7 @@ func (suite *GlideTestSuite) TestXPendingFailures() { assert.True(suite.T(), strings.Contains(err.Error(), "WRONGTYPE")) } - execCluster := func(client api.IGlideClusterClient) { + execCluster := func(client api.GlideClusterClientCommands) { // 1. Arrange the data key := uuid.New().String() missingKey := uuid.New().String() @@ -6052,9 +6052,9 @@ func (suite *GlideTestSuite) TestXPendingFailures() { // this is only needed in order to be able to use custom commands. // Once the native commands are added, this logic will be refactored. switch c := client.(type) { - case api.IGlideClient: + case api.GlideClientCommands: execStandalone(c) - case api.IGlideClusterClient: + case api.GlideClusterClientCommands: execCluster(c) } })