Skip to content

Commit

Permalink
feat: update sorted set increment name (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaddingtonwhite authored and cprice404 committed Mar 14, 2023
1 parent b38b95b commit 337c90f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions momento/simple_cache_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type SimpleCacheClient interface {
SortedSetGetScore(ctx context.Context, r *SortedSetGetScoreRequest) (SortedSetGetScoreResponse, error)
SortedSetRemove(ctx context.Context, r *SortedSetRemoveRequest) (SortedSetRemoveResponse, error)
SortedSetGetRank(ctx context.Context, r *SortedSetGetRankRequest) (SortedSetGetRankResponse, error)
SortedSetIncrement(ctx context.Context, r *SortedSetIncrementRequest) (SortedSetIncrementResponse, error)
SortedSetIncrementScore(ctx context.Context, r *SortedSetIncrementScoreRequest) (SortedSetIncrementScoreResponse, error)

ListPushFront(ctx context.Context, r *ListPushFrontRequest) (ListPushFrontResponse, error)
ListPushBack(ctx context.Context, r *ListPushBackRequest) (ListPushBackResponse, error)
Expand Down Expand Up @@ -229,7 +229,7 @@ func (c defaultScsClient) SortedSetGetRank(ctx context.Context, r *SortedSetGetR
return r.response, nil
}

func (c defaultScsClient) SortedSetIncrement(ctx context.Context, r *SortedSetIncrementRequest) (SortedSetIncrementResponse, error) {
func (c defaultScsClient) SortedSetIncrementScore(ctx context.Context, r *SortedSetIncrementScoreRequest) (SortedSetIncrementScoreResponse, error) {
if err := c.dataClient.makeRequest(ctx, r); err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import (

//////// Response

type SortedSetIncrementResponse interface {
type SortedSetIncrementScoreResponse interface {
isSortedSetIncrementResponse()
}
type SortedSetIncrementSuccess struct {
type SortedSetIncrementScoreSuccess struct {
Value float64
}

func (SortedSetIncrementSuccess) isSortedSetIncrementResponse() {}
func (SortedSetIncrementScoreSuccess) isSortedSetIncrementResponse() {}

////// Request

type SortedSetIncrementRequest struct {
type SortedSetIncrementScoreRequest struct {
CacheName string
SetName string
ElementName Bytes
Expand All @@ -29,14 +29,14 @@ type SortedSetIncrementRequest struct {

grpcRequest *pb.XSortedSetIncrementRequest
grpcResponse *pb.XSortedSetIncrementResponse
response SortedSetIncrementResponse
response SortedSetIncrementScoreResponse
}

func (r *SortedSetIncrementRequest) cacheName() string { return r.CacheName }
func (r *SortedSetIncrementScoreRequest) cacheName() string { return r.CacheName }

func (r *SortedSetIncrementRequest) requestName() string { return "Sorted set increment" }
func (r *SortedSetIncrementScoreRequest) requestName() string { return "Sorted set increment" }

func (r *SortedSetIncrementRequest) initGrpcRequest(client scsDataClient) error {
func (r *SortedSetIncrementScoreRequest) initGrpcRequest(client scsDataClient) error {
var err error

if _, err = prepareName(r.SetName, "Set name"); err != nil {
Expand All @@ -55,7 +55,7 @@ func (r *SortedSetIncrementRequest) initGrpcRequest(client scsDataClient) error
return nil
}

func (r *SortedSetIncrementRequest) makeGrpcRequest(metadata context.Context, client scsDataClient) (grpcResponse, error) {
func (r *SortedSetIncrementScoreRequest) makeGrpcRequest(metadata context.Context, client scsDataClient) (grpcResponse, error) {
resp, err := client.grpcClient.SortedSetIncrement(metadata, r.grpcRequest)
if err != nil {
return nil, err
Expand All @@ -64,8 +64,8 @@ func (r *SortedSetIncrementRequest) makeGrpcRequest(metadata context.Context, cl
return resp, nil
}

func (r *SortedSetIncrementRequest) interpretGrpcResponse() error {
r.response = &SortedSetIncrementSuccess{
func (r *SortedSetIncrementScoreRequest) interpretGrpcResponse() error {
r.response = &SortedSetIncrementScoreSuccess{
Value: r.grpcResponse.Value,
}
return nil
Expand Down

0 comments on commit 337c90f

Please sign in to comment.