From 3e5e0370ba1f12643690201ab197bd9f6e803d15 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Tue, 11 Feb 2020 20:00:11 +0200 Subject: [PATCH] temp replace directive to fix: https://github.com/mediocregopher/radix/issues/184 --- README.md | 115 ++------------------------------ action.go | 4 +- action_test.go | 2 +- bench/bench_test.go | 2 +- bench/go.mod | 8 +-- bench/go.sum | 8 +-- cluster.go | 6 +- cluster_stub_test.go | 2 +- cluster_test.go | 2 +- cluster_topo.go | 4 +- cluster_topo_test.go | 4 +- go.mod | 2 +- internal/bytesutil/bytesutil.go | 2 +- pool.go | 4 +- pool_test.go | 6 +- pubsub.go | 4 +- pubsub_persistent.go | 6 ++ pubsub_stub.go | 4 +- pubsub_stub_test.go | 2 +- radix.go | 2 +- resp/resp2/resp.go | 4 +- resp/resp2/resp_test.go | 2 +- scanner.go | 2 +- stream.go | 6 +- stub.go | 4 +- stub_test.go | 2 +- 26 files changed, 57 insertions(+), 152 deletions(-) diff --git a/README.md b/README.md index 88f3c84a..5eae1e45 100644 --- a/README.md +++ b/README.md @@ -1,117 +1,16 @@ # Radix -[![Build Status](https://travis-ci.org/mediocregopher/radix.svg)](https://travis-ci.org/mediocregopher/radix) -![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/mediocregopher/radix.svg) -[![GoDoc](https://godoc.org/github.com/mediocregopher/radix?status.svg)][godoc] -[![Go Report Card](https://goreportcard.com/badge/github.com/mediocregopher/radix/v3)](https://goreportcard.com/report/github.com/mediocregopher/radix/v3) +[![Build Status](https://travis-ci.org/neffos-contrib/radix.svg)](https://travis-ci.org/neffos-contrib/radix) +![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/neffos-contrib/radix.svg) +[![GoDoc](https://godoc.org/github.com/neffos-contrib/radix?status.svg)][godoc] +[![Go Report Card](https://goreportcard.com/badge/github.com/neffos-contrib/radix/v3)](https://goreportcard.com/report/github.com/neffos-contrib/radix/v3) Radix is a full-featured [Redis][redis] client for Go. See the [GoDoc][godoc] for documentation and general usage examples. -This is the third revision of this project, the previous one has been deprecated -but can be found [here](https://github.com/mediocregopher/radix.v2). +## neffos-contrib -## Features - -* Standard print-like API which supports all current and future redis commands. - -* Support for using an io.Reader as a command argument and writing responses to - an io.Writer, as well as marshaling/unmarshaling command arguments from - structs. - -* Connection pooling, which takes advantage of implicit pipelining to reduce - system calls. - -* Helpers for [EVAL][eval], [SCAN][scan], and manual [pipelining][pipelining]. - -* Support for [pubsub][pubsub], as well as persistent pubsub wherein if a - connection is lost a new one transparently replaces it. - -* Full support for [sentinel][sentinel] and [cluster][cluster]. - -* Nearly all important types are interfaces, allowing for custom implementations - of nearly anything. - -## Installation and Usage - -Radix always aims to support the most recent two versions of go, and is likely -to support others prior to those two. - -[Module][module]-aware mode: - - go get github.com/mediocregopher/radix/v3 - // import github.com/mediocregopher/radix/v3 - -Legacy GOPATH mode: - - go get github.com/mediocregopher/radix - // import github.com/mediocregopher/radix - -## Testing - - # requires a redis server running on 127.0.0.1:6379 - go test github.com/mediocregopher/radix/v3 - -## Benchmarks - -Thanks to a huge amount of work put in by @nussjustin, and inspiration from the -[redispipe][redispipe] project and @funny-falcon, radix/v3 is significantly -faster than most redis drivers, including redigo, for normal parallel workloads, -and is pretty comparable for serial workloads. - -Benchmarks can be run from the bench folder. The following results were obtained -by running the benchmarks with `-cpu` set to 32 and 64, on a 32 core machine, -with the redis server on a separate machine. See [this thread][bench_thread] -for more details. - -Some of radix's results are not included below because they use a non-default -configuration. - -[bench_thread]: https://github.com/mediocregopher/radix/issues/67#issuecomment-465060960 - - -``` -# go get rsc.io/benchstat -# cd bench -# go test -v -run=XXX -bench=ParallelGetSet -cpu 32 -cpu 64 -benchmem . >/tmp/radix.stat -# benchstat radix.stat -name time/op -ParallelGetSet/radix/default-32 2.15µs ± 0% <--- The good stuff -ParallelGetSet/radix/default-64 2.05µs ± 0% <--- The better stuff -ParallelGetSet/redigo-32 27.9µs ± 0% -ParallelGetSet/redigo-64 28.5µs ± 0% -ParallelGetSet/redispipe-32 2.02µs ± 0% -ParallelGetSet/redispipe-64 1.71µs ± 0% - -name alloc/op -ParallelGetSet/radix/default-32 72.0B ± 0% -ParallelGetSet/radix/default-64 84.0B ± 0% -ParallelGetSet/redigo-32 119B ± 0% -ParallelGetSet/redigo-64 120B ± 0% -ParallelGetSet/redispipe-32 168B ± 0% -ParallelGetSet/redispipe-64 172B ± 0% - -name allocs/op -ParallelGetSet/radix/default-32 4.00 ± 0% -ParallelGetSet/radix/default-64 4.00 ± 0% -ParallelGetSet/redigo-32 6.00 ± 0% -ParallelGetSet/redigo-64 6.00 ± 0% -ParallelGetSet/redispipe-32 8.00 ± 0% -ParallelGetSet/redispipe-64 8.00 ± 0% -``` - -## Copyright and licensing - -Unless otherwise noted, the source files are distributed under the *MIT License* -found in the LICENSE.txt file. +Contains temporarily fix for: https://github.com/mediocregopher/radix/issues/184. The import path of [neffos/stackexchange/redis](https://github.com/kataras/neffos/blob/master/stackexchange/redis/stackexchange_redis.go) didn't change, instead we use the [replace directive](https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive) of the [go.mod](https://github.com/kataras/neffos/blob/master/go.mod#L5) file. [redis]: http://redis.io -[godoc]: https://godoc.org/github.com/mediocregopher/radix -[eval]: https://redis.io/commands/eval -[scan]: https://redis.io/commands/scan -[pipelining]: https://redis.io/topics/pipelining -[pubsub]: https://redis.io/topics/pubsub -[sentinel]: http://redis.io/topics/sentinel -[cluster]: http://redis.io/topics/cluster-spec -[module]: https://github.com/golang/go/wiki/Modules -[redispipe]: https://github.com/joomcode/redispipe +[godoc]: https://godoc.org/github.com/neffos-contrib/radix diff --git a/action.go b/action.go index 854f36c9..b7c3a09b 100644 --- a/action.go +++ b/action.go @@ -11,8 +11,8 @@ import ( "strings" "sync" - "github.com/mediocregopher/radix/v3/resp" - "github.com/mediocregopher/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp/resp2" ) // Action performs a task using a Conn. diff --git a/action_test.go b/action_test.go index 91013b7b..247a91fc 100644 --- a/action_test.go +++ b/action_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mediocregopher/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/resp/resp2" ) func TestCmdAction(t *T) { diff --git a/bench/bench_test.go b/bench/bench_test.go index 9b229d99..b483e7f0 100644 --- a/bench/bench_test.go +++ b/bench/bench_test.go @@ -12,7 +12,7 @@ import ( redigo "github.com/gomodule/redigo/redis" redispipe "github.com/joomcode/redispipe/redis" redispipeconn "github.com/joomcode/redispipe/redisconn" - "github.com/mediocregopher/radix/v3" + "github.com/neffos-contrib/radix/v3" ) func newRedigo() redigo.Conn { diff --git a/bench/go.mod b/bench/go.mod index e768b85c..79290eb9 100644 --- a/bench/go.mod +++ b/bench/go.mod @@ -1,12 +1,12 @@ -module github.com/mediocregopher/radix/bench +module github.com/neffos-contrib/radix/bench require ( github.com/garyburd/redigo v1.6.0 // indirect github.com/gomodule/redigo v2.0.0+incompatible github.com/joomcode/errorx v0.8.0 // indirect github.com/joomcode/redispipe v0.9.0 - github.com/mediocregopher/radix.v2 v0.0.0-20181115013041-b67df6e626f9 // indirect - github.com/mediocregopher/radix/v3 v3.2.0 + github.com/neffos-contrib/radix.v2 v0.0.0-20181115013041-b67df6e626f9 // indirect + github.com/neffos-contrib/radix/v3 v3.2.0 ) -replace github.com/mediocregopher/radix/v3 => ../. +replace github.com/neffos-contrib/radix/v3 => ../. diff --git a/bench/go.sum b/bench/go.sum index d069d4a7..5d94b954 100644 --- a/bench/go.sum +++ b/bench/go.sum @@ -8,10 +8,10 @@ github.com/joomcode/errorx v0.8.0 h1:GhAqPtcYuo1O7TOIbtzEIDzPGQ3SrKJ3tdjXNmUtDNo github.com/joomcode/errorx v0.8.0/go.mod h1:kgco15ekB6cs+4Xjzo7SPeXzx38PbJzBwbnu9qfVNHQ= github.com/joomcode/redispipe v0.9.0 h1:NukwwIvxhg6r2lVxa1RJhEZXYPZZF/OX9WZJk+2cK1Q= github.com/joomcode/redispipe v0.9.0/go.mod h1:4S/gpBCZ62pB/3+XLNWDH7jQnB0vxmpddAMBva2adpM= -github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed h1:3dQJqqDouawQgl3gBE1PNHKFkJYGEuFb1DbSlaxdosE= -github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg= -github.com/mediocregopher/radix.v2 v0.0.0-20181115013041-b67df6e626f9 h1:ViNuGS149jgnttqhc6XQNPwdupEMBXqCx9wtlW7P3sA= -github.com/mediocregopher/radix.v2 v0.0.0-20181115013041-b67df6e626f9/go.mod h1:fLRUbhbSd5Px2yKUaGYYPltlyxi1guJz1vCmo1RQL50= +github.com/neffos-contrib/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed h1:3dQJqqDouawQgl3gBE1PNHKFkJYGEuFb1DbSlaxdosE= +github.com/neffos-contrib/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg= +github.com/neffos-contrib/radix.v2 v0.0.0-20181115013041-b67df6e626f9 h1:ViNuGS149jgnttqhc6XQNPwdupEMBXqCx9wtlW7P3sA= +github.com/neffos-contrib/radix.v2 v0.0.0-20181115013041-b67df6e626f9/go.mod h1:fLRUbhbSd5Px2yKUaGYYPltlyxi1guJz1vCmo1RQL50= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= diff --git a/cluster.go b/cluster.go index 316c51e6..504448e1 100644 --- a/cluster.go +++ b/cluster.go @@ -9,9 +9,9 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/resp" - "github.com/mediocregopher/radix/v3/resp/resp2" - "github.com/mediocregopher/radix/v3/trace" + "github.com/neffos-contrib/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/trace" ) // dedupe is used to deduplicate a function invocation, so if multiple diff --git a/cluster_stub_test.go b/cluster_stub_test.go index 6df6fe44..95dda2e7 100644 --- a/cluster_stub_test.go +++ b/cluster_stub_test.go @@ -10,7 +10,7 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/resp/resp2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/cluster_test.go b/cluster_test.go index c21564ac..28fe5693 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mediocregopher/radix/v3/trace" + "github.com/neffos-contrib/radix/v3/trace" ) // clusterSlotKeys contains a random key for every slot. Unfortunately I haven't diff --git a/cluster_topo.go b/cluster_topo.go index ef94e215..25b60e6f 100644 --- a/cluster_topo.go +++ b/cluster_topo.go @@ -8,8 +8,8 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/resp" - "github.com/mediocregopher/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp/resp2" ) // ClusterNode describes a single node in the cluster at a moment in time. diff --git a/cluster_topo_test.go b/cluster_topo_test.go index 80a5b1d3..ca13d01a 100644 --- a/cluster_topo_test.go +++ b/cluster_topo_test.go @@ -5,8 +5,8 @@ import ( "bytes" . "testing" - "github.com/mediocregopher/radix/v3/resp" - "github.com/mediocregopher/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp/resp2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/go.mod b/go.mod index bb9be395..21daa53a 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/mediocregopher/radix/v3 +module github.com/neffos-contrib/radix/v3 require ( github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/internal/bytesutil/bytesutil.go b/internal/bytesutil/bytesutil.go index f15da032..f2ea7e0f 100644 --- a/internal/bytesutil/bytesutil.go +++ b/internal/bytesutil/bytesutil.go @@ -9,7 +9,7 @@ import ( "strconv" "sync" - "github.com/mediocregopher/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp" errors "golang.org/x/xerrors" ) diff --git a/pool.go b/pool.go index 196b4eb9..01e3f1cd 100644 --- a/pool.go +++ b/pool.go @@ -9,8 +9,8 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/resp" - "github.com/mediocregopher/radix/v3/trace" + "github.com/neffos-contrib/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/trace" ) // ErrPoolEmpty is used by Pools created using the PoolOnEmptyErrAfter option diff --git a/pool_test.go b/pool_test.go index 06e1a46f..618e1b9d 100644 --- a/pool_test.go +++ b/pool_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/require" errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/resp" - "github.com/mediocregopher/radix/v3/resp/resp2" - "github.com/mediocregopher/radix/v3/trace" + "github.com/neffos-contrib/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/trace" ) func testPool(size int, opts ...PoolOpt) *Pool { diff --git a/pubsub.go b/pubsub.go index 30ac5c21..70c4ffe0 100644 --- a/pubsub.go +++ b/pubsub.go @@ -10,8 +10,8 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/resp" - "github.com/mediocregopher/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp/resp2" ) // PubSubMessage describes a message being published to a subscribed channel diff --git a/pubsub_persistent.go b/pubsub_persistent.go index a6919838..0766abc2 100644 --- a/pubsub_persistent.go +++ b/pubsub_persistent.go @@ -133,6 +133,12 @@ func (p *persistentPubSub) refresh() error { go func() { select { case <-errCh: + // temp fix: https://github.com/neffos-contrib/radix/issues/184 + select { + case <-p.closeCh: + return + default: + } p.l.Lock() // It's possible that one of the methods (e.g. Subscribe) // already had the lock, saw the error, and called refresh. This diff --git a/pubsub_stub.go b/pubsub_stub.go index d2c266ec..4d6bc080 100644 --- a/pubsub_stub.go +++ b/pubsub_stub.go @@ -8,8 +8,8 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/resp" - "github.com/mediocregopher/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp/resp2" ) var errPubSubMode = resp2.Error{ diff --git a/pubsub_stub_test.go b/pubsub_stub_test.go index f064350b..009183d1 100644 --- a/pubsub_stub_test.go +++ b/pubsub_stub_test.go @@ -5,7 +5,7 @@ import ( . "testing" "time" - "github.com/mediocregopher/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/resp/resp2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/radix.go b/radix.go index 78770e4d..f83cf2dc 100644 --- a/radix.go +++ b/radix.go @@ -173,7 +173,7 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp" ) var errClientClosed = errors.New("client is closed") diff --git a/resp/resp2/resp.go b/resp/resp2/resp.go index c6d84a58..89b16000 100644 --- a/resp/resp2/resp.go +++ b/resp/resp2/resp.go @@ -18,8 +18,8 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/internal/bytesutil" - "github.com/mediocregopher/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/internal/bytesutil" + "github.com/neffos-contrib/radix/v3/resp" ) var delim = []byte{'\r', '\n'} diff --git a/resp/resp2/resp_test.go b/resp/resp2/resp_test.go index c469a9b0..571f586e 100644 --- a/resp/resp2/resp_test.go +++ b/resp/resp2/resp_test.go @@ -9,7 +9,7 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/scanner.go b/scanner.go index a1f1a78d..9eeedaac 100644 --- a/scanner.go +++ b/scanner.go @@ -7,7 +7,7 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/resp/resp2" ) // Scanner is used to iterate through the results of a SCAN call (or HSCAN, diff --git a/stream.go b/stream.go index 80eb7343..b2c17390 100644 --- a/stream.go +++ b/stream.go @@ -11,9 +11,9 @@ import ( errors "golang.org/x/xerrors" - "github.com/mediocregopher/radix/v3/internal/bytesutil" - "github.com/mediocregopher/radix/v3/resp" - "github.com/mediocregopher/radix/v3/resp/resp2" + "github.com/neffos-contrib/radix/v3/internal/bytesutil" + "github.com/neffos-contrib/radix/v3/resp" + "github.com/neffos-contrib/radix/v3/resp/resp2" ) // StreamEntryID represents an ID used in a Redis stream with the format