Skip to content

Commit

Permalink
Support TairRoaring module (#4)
Browse files Browse the repository at this point in the history
Support TairRoaring module

Co-authored-by: bodong.ybd <bodong.ybd@alibaba-inc.com>
  • Loading branch information
bigdaronlee163 and yangbodong22011 authored Aug 8, 2022
1 parent a9f9a48 commit 3bb0871
Show file tree
Hide file tree
Showing 8 changed files with 652 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ jobs:
go test -v ./... -run TestTairStringTestSuite/TestTairStringTestSuite
go test -v ./... -run TestTairStringTestSuite/TestTairHashTestSuite
go test -v ./... -run TestTairStringTestSuite/TestTairZsetTestSuite
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*.ipr
*.iws
.idea/

.vscode
# Binaries for programs and plugins
*.exe
*.exe~
Expand All @@ -20,3 +20,4 @@
# Dependency directories (remove the comment below to include it)
# vendor/

main_test.go
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@ go 1.17

require (
github.com/go-redis/redis/v8 v8.11.5
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.18.1
github.com/stretchr/testify v1.8.0
)

require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
Expand All @@ -38,6 +39,7 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ=
github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
Expand Down Expand Up @@ -104,6 +106,7 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
4 changes: 2 additions & 2 deletions tair/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func redisOptions() *redis.Options {
DialTimeout: 10 * time.Second,
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,

MaxRetries: -1,
Password: "xxx",
MaxRetries: -1,

PoolSize: 10,
PoolTimeout: 30 * time.Second,
Expand Down
31 changes: 31 additions & 0 deletions tair/taircommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,35 @@ type TairCmdable interface {
ExHVals(ctx context.Context, key string) *redis.StringSliceCmd
ExHGetAll(ctx context.Context, key string) *redis.StringStringMapCmd
ExHScan(ctx context.Context, key string, cursor string) *redis.SliceCmd

// TairRoaring
TrSetBit(ctx context.Context, key string, offset int64, value int64) *redis.IntCmd
TrSetBits(ctx context.Context, key string, fields ...int64) *redis.IntCmd
TrGetBit(ctx context.Context, key string, offset int64) *redis.IntCmd
TrGetBits(ctx context.Context, key string, fields ...int64) *redis.IntSliceCmd
TrClearBits(ctx context.Context, key string, fields ...int64) *redis.IntCmd
TrRange(ctx context.Context, key string, start int64, end int64) *redis.IntSliceCmd
TrRangeBitArray(ctx context.Context, key string, start int64, end int64) *redis.StringCmd
TrAppendBitArray(ctx context.Context, key string, offset int64, value string) *redis.IntCmd
TrSetRange(ctx context.Context, key string, start int64, end int64) *redis.IntCmd
TrFlipRange(ctx context.Context, key string, start int64, end string) *redis.IntCmd
TrBitCount(ctx context.Context, key string) *redis.IntCmd
TrBitCountRange(ctx context.Context, key string, start int64, end int64) *redis.IntCmd
TrMin(ctx context.Context, key string) *redis.IntCmd
TrMax(ctx context.Context, key string) *redis.IntCmd
TrOptimize(ctx context.Context, key string) *redis.StringCmd
TrStat(ctx context.Context, key string, json bool) *redis.StringCmd
TrBitPosCount(ctx context.Context, key string, value int64, count int64) *redis.IntCmd
TrBitPos(ctx context.Context, key string, value int64) *redis.IntCmd
TrRank(ctx context.Context, key string, offset int64) *redis.IntCmd
TrBitOp(ctx context.Context, destKey string, operation string, keys ...string) *redis.IntCmd
TrBitOpCard(ctx context.Context, operation string, keys ...string) *redis.IntCmd
TrScanCount(ctx context.Context, key string, cursor int64, count int64) *redis.SliceCmd
TrScan(ctx context.Context, key string, cursor int64) *redis.SliceCmd
TrDiff(ctx context.Context, destKey, key1, key2 string) *redis.StringCmd
TrSetIntArray(ctx context.Context, key string, fields ...int64) *redis.StringCmd
TrAppendIntArray(ctx context.Context, key string, fields ...int64) *redis.StringCmd
TrSetBitArray(ctx context.Context, key, value string) *redis.FloatCmd
TrJaccard(ctx context.Context, key1, key2 string) *redis.FloatCmd
TrContains(ctx context.Context, key1, key2 string) *redis.BoolCmd
}
Loading

0 comments on commit 3bb0871

Please sign in to comment.