Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed May 18, 2023
1 parent 7224e20 commit 9129cf7
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,10 @@ func createClientWithKeyspace(
type APIVersion int

// The API versions the client supports.
// As for V1TTL, client won't use it and we just remove it.
const (
V1 APIVersion = iota
V1TTL
_
V2
)

Expand All @@ -424,23 +425,6 @@ func (apiCtx *apiContextV1) GetKeyspaceName() (keyspaceName string) {
return ""
}

type apiContextV1TTL struct{}

// NewAPIContextV1TTL creates a API context for V1TTL.
func NewAPIContextV1TTL() APIContext {
return &apiContextV1TTL{}
}

// GetAPIVersion returns the API version.
func (apiCtx *apiContextV1TTL) GetAPIVersion() (version APIVersion) {
return V1TTL
}

// GetKeyspaceName returns the keyspace name.
func (apiCtx *apiContextV1TTL) GetKeyspaceName() (keyspaceName string) {
return ""
}

type apiContextV2 struct {
keyspaceName string
}
Expand Down Expand Up @@ -470,7 +454,7 @@ func NewClientWithAPIContext(
) (Client, error) {
apiVersion, keyspaceName := apiCtx.GetAPIVersion(), apiCtx.GetKeyspaceName()
switch apiVersion {
case V1, V1TTL:
case V1:
return NewClientWithContext(ctx, svrAddrs, security, opts...)
case V2:
return newClientWithKeyspaceName(ctx, keyspaceName, svrAddrs, security, opts...)
Expand Down

0 comments on commit 9129cf7

Please sign in to comment.