Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ all: test coverage build
build:
$(GOBUILD) .

docker-build:
@docker-compose -f docker-compose.yaml build

checkfmt:
@echo 'Checking gofmt';\
bash -c "diff -u <(echo -n) <(gofmt -d .)";\
Expand Down
33 changes: 33 additions & 0 deletions cluster_conn.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import (
"github.com/mediocregopher/radix/v3"
"log"
)

func getOSSClusterConn(addr string, opts []radix.DialOpt, clients uint64) *radix.Cluster {
var vanillaCluster *radix.Cluster
var err error

customConnFunc := func(network, addr string) (radix.Conn, error) {
return radix.Dial(network, addr, opts...,
)
}

// this cluster will use the ClientFunc to create a pool to each node in the
// cluster.
poolFunc := func(network, addr string) (radix.Client, error) {
return radix.NewPool(network, addr, int(clients), radix.PoolConnFunc(customConnFunc), radix.PoolPipelineWindow(0, 0))
}

vanillaCluster, err = radix.NewCluster([]string{addr}, radix.ClusterPoolFunc(poolFunc))
if err != nil {
log.Fatalf("Error preparing for benchmark, while creating new connection. error = %v", err)
}
// Issue CLUSTER SLOTS command
err = vanillaCluster.Sync()
if err != nil {
log.Fatalf("Error preparing for benchmark, while issuing CLUSTER SLOTS. error = %v", err)
}
return vanillaCluster
}
8 changes: 7 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ go 1.14

require (
github.com/HdrHistogram/hdrhistogram-go v0.9.0
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 // indirect
github.com/codahale/hdrhistogram v0.9.0 // indirect
github.com/golangci/golangci-lint v1.31.0 // indirect
github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 // indirect
github.com/golangci/golangci-lint v1.35.2 // indirect
github.com/mediocregopher/radix/v3 v3.5.2
github.com/sclevine/agouti v3.0.0+incompatible // indirect
github.com/ugorji/go v1.1.4 // indirect
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
)
Loading