Skip to content

Commit

Permalink
Unexport helper command
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Mar 12, 2021
1 parent d47e48f commit 573638f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://uptrace.dev/?utm_source=gh-redis&utm_campaign=gh-redis-banner1">
<img src="https://raw.githubusercontent.com/uptrace/roadmap/master/banner1.png">
<img src="https://raw.githubusercontent.com/uptrace/roadmap/master/banner1.png" alt="All-in-one tool to optimize performance and monitor errors & logs">
</a>
</p>

Expand Down
11 changes: 11 additions & 0 deletions export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net"
"strings"

"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/hashtag"
"github.com/go-redis/redis/v8/internal/pool"
)
Expand Down Expand Up @@ -82,3 +83,13 @@ func (state *clusterState) IsConsistent(ctx context.Context) bool {

return true
}

func GetSlavesAddrByName(ctx context.Context, c *SentinelClient, name string) []string {
addrs, err := c.Slaves(ctx, name).Result()
if err != nil {
internal.Logger.Printf(ctx, "sentinel: Slaves name=%q failed: %s",
name, err)
return []string{}
}
return parseSlaveAddrs(addrs, false)
}
10 changes: 0 additions & 10 deletions sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,6 @@ func (c *SentinelClient) GetMasterAddrByName(ctx context.Context, name string) *
return cmd
}

func (c *SentinelClient) GetSlavesAddrByName(ctx context.Context, name string) []string {
addrs, err := c.Slaves(ctx, name).Result()
if err != nil {
internal.Logger.Printf(ctx, "sentinel: Slaves name=%q failed: %s",
name, err)
return []string{}
}
return parseSlaveAddrs(addrs, false)
}

func (c *SentinelClient) Sentinels(ctx context.Context, name string) *SliceCmd {
cmd := NewSliceCmd(ctx, "sentinel", "sentinels", name)
_ = c.Process(ctx, cmd)
Expand Down
2 changes: 1 addition & 1 deletion sentinel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var _ = Describe("Sentinel", func() {
// Verify master->slaves sync.
var slavesAddr []string
Eventually(func() []string {
slavesAddr = sentinel.GetSlavesAddrByName(ctx, sentinelName)
slavesAddr = redis.GetSlavesAddrByName(ctx, sentinel, sentinelName)
return slavesAddr
}, "15s", "100ms").Should(HaveLen(2))
Eventually(func() bool {
Expand Down

0 comments on commit 573638f

Please sign in to comment.