Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
temp replace directive to fix: mediocregopher#184
Browse files Browse the repository at this point in the history
  • Loading branch information
kataras committed Feb 11, 2020
1 parent a869bb2 commit 3e5e037
Show file tree
Hide file tree
Showing 26 changed files with 57 additions and 152 deletions.
115 changes: 7 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions action.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion bench/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions bench/go.mod
Original file line number Diff line number Diff line change
@@ -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 => ../.
8 changes: 4 additions & 4 deletions bench/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
6 changes: 3 additions & 3 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cluster_stub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cluster_topo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions cluster_topo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/bytesutil/bytesutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
4 changes: 2 additions & 2 deletions pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions pubsub_persistent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pubsub_stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion pubsub_stub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion radix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions resp/resp2/resp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down
2 changes: 1 addition & 1 deletion resp/resp2/resp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <time>-<seq>.
Expand Down
4 changes: 2 additions & 2 deletions stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,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"
)

type bufferAddr struct {
Expand Down
2 changes: 1 addition & 1 deletion stub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit 3e5e037

Please sign in to comment.