Skip to content

Commit

Permalink
Renamed interfaces to be more informative
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Liang <[email protected]>
  • Loading branch information
edlng committed Jan 22, 2025
1 parent e14cc01 commit f77e2e3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion go/api/base_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions go/api/glide_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions go/api/glide_cluster_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions go/integTest/glide_test_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -227,15 +227,15 @@ 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).
WithRequestTimeout(5000)
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)
Expand All @@ -245,15 +245,15 @@ 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).
WithRequestTimeout(5000)
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)
Expand Down
22 changes: 11 additions & 11 deletions go/integTest/shared_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
})
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
})
Expand Down

0 comments on commit f77e2e3

Please sign in to comment.