Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into go/pkgsite-fix
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Liang <[email protected]>
  • Loading branch information
edlng committed Jan 21, 2025
2 parents a5eda6f + 502a8d7 commit 78715d6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions 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 [GlideClusterClient].
// BaseClient defines an interface for methods common to both [IGlideClient] and [IGlideClusterClient].
type BaseClient interface {
StringCommands
HashCommands
Expand Down Expand Up @@ -1275,8 +1275,8 @@ func (client *baseClient) HScan(key string, cursor string) (string, []string, er
// // Assume key contains a hash {{"a": "1"}, {"b", "2"}}
// opts := options.NewHashScanOptionsBuilder().SetMatch("a")
// resCursor, resCollection, err = client.HScan(key, initialCursor, opts)
// // resCursor = {0 false}
// // resCollection = [{a false} {1 false}]
// // resCursor = 0
// // resCollection = [a 1]
// // The resCollection only contains the hash map entry that matches with the match option provided with the command
// // input.
//
Expand Down
18 changes: 9 additions & 9 deletions go/api/glide_cluster_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ package api
import "C"

// GlideClusterClient interface compliance check.
var _ GlideClusterClient = (*glideClusterClient)(nil)
var _ IGlideClusterClient = (*GlideClusterClient)(nil)

// GlideClusterClient is a client used for connection in cluster mode.
type GlideClusterClient interface {
// IGlideClusterClient is a client used for connection in cluster mode.
type IGlideClusterClient interface {
BaseClient
GenericClusterCommands
}

// glideClusterClient implements cluster mode operations by extending baseClient functionality.
type glideClusterClient struct {
// GlideClusterClient implements cluster mode operations by extending baseClient functionality.
type GlideClusterClient struct {
*baseClient
}

// NewGlideClusterClient creates a [GlideClusterClient] in cluster mode using the given [GlideClusterClientConfiguration].
func NewGlideClusterClient(config *GlideClusterClientConfiguration) (GlideClusterClient, error) {
// NewGlideClusterClient creates a [IGlideClusterClient] in cluster mode using the given [GlideClusterClientConfiguration].
func NewGlideClusterClient(config *GlideClusterClientConfiguration) (IGlideClusterClient, error) {
client, err := createClient(config)
if err != nil {
return nil, err
}

return &glideClusterClient{client}, nil
return &GlideClusterClient{client}, nil
}

// CustomCommand executes a single command, specified by args, without checking inputs. Every part of the command,
Expand Down Expand Up @@ -57,7 +57,7 @@ func NewGlideClusterClient(config *GlideClusterClientConfiguration) (GlideCluste
// result.Value().(string): "PONG"
//
// [Valkey GLIDE Wiki]: https://github.com/valkey-io/valkey-glide/wiki/General-Concepts#custom-command
func (client *glideClusterClient) CustomCommand(args []string) (ClusterValue[interface{}], error) {
func (client *GlideClusterClient) CustomCommand(args []string) (ClusterValue[interface{}], error) {
res, err := client.executeCommand(C.CustomCommand, args)
if err != nil {
return CreateEmptyClusterValue(), err
Expand Down
6 changes: 3 additions & 3 deletions go/integTest/glide_test_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type GlideTestSuite struct {
tls bool
serverVersion string
clients []api.IGlideClient
clusterClients []api.GlideClusterClient
clusterClients []api.IGlideClusterClient
}

var (
Expand Down Expand Up @@ -245,15 +245,15 @@ func (suite *GlideTestSuite) client(config *api.GlideClientConfiguration) api.IG
return client
}

func (suite *GlideTestSuite) defaultClusterClient() api.GlideClusterClient {
func (suite *GlideTestSuite) defaultClusterClient() api.IGlideClusterClient {
config := api.NewGlideClusterClientConfiguration().
WithAddress(&suite.clusterHosts[0]).
WithUseTLS(suite.tls).
WithRequestTimeout(5000)
return suite.clusterClient(config)
}

func (suite *GlideTestSuite) clusterClient(config *api.GlideClusterClientConfiguration) api.GlideClusterClient {
func (suite *GlideTestSuite) clusterClient(config *api.GlideClusterClientConfiguration) api.IGlideClusterClient {
client, err := api.NewGlideClusterClient(config)

assert.Nil(suite.T(), err)
Expand Down
10 changes: 5 additions & 5 deletions go/integTest/shared_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4100,7 +4100,7 @@ func sendWithCustomCommand(suite *GlideTestSuite, client api.BaseClient, args []
switch c := client.(type) {
case api.IGlideClient:
res, err = c.CustomCommand(args)
case api.GlideClusterClient:
case api.IGlideClusterClient:
res, err = c.CustomCommand(args)
default:
suite.FailNow(errMsg)
Expand Down Expand Up @@ -5486,7 +5486,7 @@ func (suite *GlideTestSuite) TestXPending() {
assert.Equal(suite.T(), streamid_2.Value(), detailResult[1].Id)
}

execCluster := func(client api.GlideClusterClient) {
execCluster := func(client api.IGlideClusterClient) {
// 1. Arrange the data
key := uuid.New().String()
groupName := "group" + uuid.New().String()
Expand Down Expand Up @@ -5570,7 +5570,7 @@ func (suite *GlideTestSuite) TestXPending() {
switch c := client.(type) {
case api.IGlideClient:
execStandalone(c)
case api.GlideClusterClient:
case api.IGlideClusterClient:
execCluster(c)
}
})
Expand Down Expand Up @@ -5736,7 +5736,7 @@ func (suite *GlideTestSuite) TestXPendingFailures() {
assert.True(suite.T(), strings.Contains(err.Error(), "WRONGTYPE"))
}

execCluster := func(client api.GlideClusterClient) {
execCluster := func(client api.IGlideClusterClient) {
// 1. Arrange the data
key := uuid.New().String()
missingKey := uuid.New().String()
Expand Down Expand Up @@ -5894,7 +5894,7 @@ func (suite *GlideTestSuite) TestXPendingFailures() {
switch c := client.(type) {
case api.IGlideClient:
execStandalone(c)
case api.GlideClusterClient:
case api.IGlideClusterClient:
execCluster(c)
}
})
Expand Down

0 comments on commit 78715d6

Please sign in to comment.