Skip to content

Commit

Permalink
rename package to dicedb
Browse files Browse the repository at this point in the history
  • Loading branch information
JyotinderSingh committed Oct 10, 2024
1 parent fc365d5 commit 5558cae
Show file tree
Hide file tree
Showing 70 changed files with 1,419 additions and 1,418 deletions.
2 changes: 1 addition & 1 deletion WatchCommand.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redis
package dicedb

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion acl_commands.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redis
package dicedb

import "context"

Expand Down
2 changes: 1 addition & 1 deletion bench_decode_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redis
package dicedb

import (
"context"
Expand Down
26 changes: 13 additions & 13 deletions bench_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redis_test
package dicedb_test

import (
"bytes"
Expand All @@ -13,8 +13,8 @@ import (
"github.com/dicedb/go-dice"
)

func benchmarkRedisClient(ctx context.Context, poolSize int) *redis.Client {
client := redis.NewClient(&redis.Options{
func benchmarkRedisClient(ctx context.Context, poolSize int) *dicedb.Client {
client := dicedb.NewClient(&dicedb.Options{
Addr: ":6379",
DialTimeout: time.Second,
ReadTimeout: time.Second,
Expand Down Expand Up @@ -76,7 +76,7 @@ func BenchmarkRedisGetNil(b *testing.B) {

b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
if err := client.Get(ctx, "key").Err(); err != redis.Nil {
if err := client.Get(ctx, "key").Err(); err != dicedb.Nil {
b.Fatal(err)
}
}
Expand Down Expand Up @@ -202,7 +202,7 @@ func BenchmarkPipeline(b *testing.B) {

b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
_, err := client.Pipelined(ctx, func(pipe redis.Pipeliner) error {
_, err := client.Pipelined(ctx, func(pipe dicedb.Pipeliner) error {
pipe.Set(ctx, "key", "hello", 0)
pipe.Expire(ctx, "key", time.Second)
return nil
Expand All @@ -223,7 +223,7 @@ func BenchmarkZAdd(b *testing.B) {

b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
err := client.ZAdd(ctx, "key", redis.Z{
err := client.ZAdd(ctx, "key", dicedb.Z{
Score: float64(1),
Member: "hello",
}).Err()
Expand All @@ -239,7 +239,7 @@ func BenchmarkXRead(b *testing.B) {
client := benchmarkRedisClient(ctx, 10)
defer client.Close()

args := redis.XAddArgs{
args := dicedb.XAddArgs{
Stream: "1",
ID: "*",
Values: map[string]string{"uno": "dos"},
Expand All @@ -261,7 +261,7 @@ func BenchmarkXRead(b *testing.B) {
for pb.Next() {
client.XAdd(ctx, &args)

err := client.XRead(ctx, &redis.XReadArgs{
err := client.XRead(ctx, &dicedb.XReadArgs{
Streams: streams,
Count: 1,
Block: time.Second,
Expand All @@ -280,7 +280,7 @@ func newClusterScenario() *clusterScenario {
ports: []string{"8220", "8221", "8222", "8223", "8224", "8225"},
nodeIDs: make([]string, 6),
processes: make(map[string]*redisProcess, 6),
clients: make(map[string]*redis.Client, 6),
clients: make(map[string]*dicedb.Client, 6),
}
}

Expand Down Expand Up @@ -387,14 +387,14 @@ func BenchmarkExecRingSetAddrsCmd(b *testing.B) {
processes = nil
})

ring := redis.NewRing(&redis.RingOptions{
ring := dicedb.NewRing(&dicedb.RingOptions{
Addrs: map[string]string{
"ringShardOne": ":" + ringShard1Port,
},
NewClient: func(opt *redis.Options) *redis.Client {
NewClient: func(opt *dicedb.Options) *dicedb.Client {
// Simulate slow shard creation
time.Sleep(100 * time.Millisecond)
return redis.NewClient(opt)
return dicedb.NewClient(opt)
},
})
defer ring.Close()
Expand Down Expand Up @@ -431,7 +431,7 @@ func BenchmarkExecRingSetAddrsCmd(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
if _, err := ring.Ping(context.Background()).Result(); err != nil {
if err == redis.ErrClosed {
if err == dicedb.ErrClosed {
// The shard client could be closed while ping command is in progress
continue
} else {
Expand Down
2 changes: 1 addition & 1 deletion bitmap_commands.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redis
package dicedb

import (
"context"
Expand Down
16 changes: 8 additions & 8 deletions bitmap_commands_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redis_test
package dicedb_test

import (
. "github.com/bsm/ginkgo/v2"
Expand All @@ -13,11 +13,11 @@ type bitCountExpected struct {
}

var _ = Describe("BitCountBite", func() {
var client *redis.Client
var client *dicedb.Client
key := "bit_count_test"

BeforeEach(func() {
client = redis.NewClient(redisOptions())
client = dicedb.NewClient(redisOptions())
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred())
values := []int{0, 1, 0, 0, 1, 0, 1, 0, 1, 1}
for i, v := range values {
Expand Down Expand Up @@ -45,19 +45,19 @@ var _ = Describe("BitCountBite", func() {
}

for _, e := range expected {
cmd := client.BitCount(ctx, key, &redis.BitCount{Start: e.Start, End: e.End, Unit: redis.BitCountIndexBit})
cmd := client.BitCount(ctx, key, &dicedb.BitCount{Start: e.Start, End: e.End, Unit: dicedb.BitCountIndexBit})
Expect(cmd.Err()).NotTo(HaveOccurred())
Expect(cmd.Val()).To(Equal(e.Expected))
}
})
})

var _ = Describe("BitCountByte", func() {
var client *redis.Client
var client *dicedb.Client
key := "bit_count_test"

BeforeEach(func() {
client = redis.NewClient(redisOptions())
client = dicedb.NewClient(redisOptions())
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred())
values := []int{0, 0, 0, 0, 0, 0, 0, 1, 1, 1}
for i, v := range values {
Expand All @@ -77,7 +77,7 @@ var _ = Describe("BitCountByte", func() {
}

for _, e := range expected {
cmd := client.BitCount(ctx, key, &redis.BitCount{Start: e.Start, End: e.End, Unit: redis.BitCountIndexByte})
cmd := client.BitCount(ctx, key, &dicedb.BitCount{Start: e.Start, End: e.End, Unit: dicedb.BitCountIndexByte})
Expect(cmd.Err()).NotTo(HaveOccurred())
Expect(cmd.Val()).To(Equal(e.Expected))
}
Expand All @@ -90,7 +90,7 @@ var _ = Describe("BitCountByte", func() {
}

for _, e := range expected {
cmd := client.BitCount(ctx, key, &redis.BitCount{Start: e.Start, End: e.End})
cmd := client.BitCount(ctx, key, &dicedb.BitCount{Start: e.Start, End: e.End})
Expect(cmd.Err()).NotTo(HaveOccurred())
Expect(cmd.Val()).To(Equal(e.Expected))
}
Expand Down
2 changes: 1 addition & 1 deletion cluster_commands.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redis
package dicedb

import "context"

Expand Down
2 changes: 1 addition & 1 deletion command.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redis
package dicedb

import (
"bufio"
Expand Down
8 changes: 4 additions & 4 deletions command_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redis_test
package dicedb_test

import (
"errors"
Expand All @@ -11,10 +11,10 @@ import (
)

var _ = Describe("Cmd", func() {
var client *redis.Client
var client *dicedb.Client

BeforeEach(func() {
client = redis.NewClient(redisOptions())
client = dicedb.NewClient(redisOptions())
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred())
})

Expand Down Expand Up @@ -88,7 +88,7 @@ var _ = Describe("Cmd", func() {

It("allows to set custom error", func() {
e := errors.New("custom error")
cmd := redis.Cmd{}
cmd := dicedb.Cmd{}
cmd.SetErr(e)
_, err := cmd.Result()
Expect(err).To(Equal(e))
Expand Down
2 changes: 1 addition & 1 deletion commands.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redis
package dicedb

import (
"context"
Expand Down
Loading

0 comments on commit 5558cae

Please sign in to comment.