Skip to content

Commit

Permalink
adjust import pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhao committed Oct 16, 2018
1 parent fd28e2a commit 34456dd
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions cmd/proxy/proxy-cluster-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ping_fail_limit = 3
ping_auto_eject = true
# A list of server address, port and weight (name:port:weight or ip:port:weight) for this server pool. Also you can use alias name like: ip:port:weight alias.
servers = [
"127.0.0.1:11211:1 aa",
"127.0.0.1:11211:1 mc1",
]

[[clusters]]
Expand Down Expand Up @@ -63,7 +63,7 @@ ping_fail_limit = 3
ping_auto_eject = false
# A list of server address, port and weight (name:port:weight or ip:port:weight) for this server pool. Also you can use alias name like: ip:port:weight alias.
servers = [
"127.0.0.1:6379:1",
"127.0.0.1:6379:1 redis1",
]

[[clusters]]
Expand Down
4 changes: 2 additions & 2 deletions proto/memcache/node_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ package memcache

import (
"bytes"
"strconv"
"sync/atomic"
"time"

"overlord/lib/bufio"
"overlord/lib/log"
libnet "overlord/lib/net"
"overlord/proto"

"github.com/pkg/errors"
"overlord/lib/log"
"strconv"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions proto/redis/proxy_conn_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package redis

import (
"errors"
"testing"

"overlord/proto"

"errors"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -284,7 +284,7 @@ func TestEncodeWithPing(t *testing.T) {
rTp: respArray,
array: []*resp{
&resp{
rTp: respBulk,
rTp: respBulk,
data: []byte("4\r\nPING"),
},
},
Expand Down
8 changes: 3 additions & 5 deletions proto/redis/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"sync"
)

const evalArgsMinCount int = 4;

var (
emptyBytes = []byte("")
crlfBytes = []byte("\r\n")
Expand Down Expand Up @@ -124,7 +122,7 @@ var (
"15\r\nZREMRANGEBYRANK" +
"16\r\nZREMRANGEBYSCORE" +
"5\r\nPFADD" +
"7\r\nPFMERGE"+
"7\r\nPFMERGE" +
"4\r\nEVAL")

reqNotSupportCmdsBytes = []byte("" +
Expand All @@ -146,7 +144,6 @@ var (
"4\r\nSCAN" +
"4\r\nWAIT" +
"5\r\nBITOP" +
"4\r\nEVAL" +
"7\r\nEVALSHA" +
"4\r\nAUTH" +
"4\r\nECHO" +
Expand Down Expand Up @@ -233,8 +230,9 @@ func (r *Request) Key() []byte {

k := r.resp.array[1]
// SUPPORT EVAL command
const evalArgsMinCount int = 4
if r.resp.arrayn >= evalArgsMinCount {
if bytes.Equal(r.resp.array[0].data, []byte("4\r\nEVAL")) {
if bytes.Equal(r.resp.array[0].data, cmdEvalBytes) {
// find the 4th key with index 3
k = r.resp.array[3]
}
Expand Down
13 changes: 7 additions & 6 deletions proto/redis/resp.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package redis

import (
"overlord/lib/bufio"
"overlord/lib/conv"
"bytes"
"fmt"

"overlord/lib/bufio"
"overlord/lib/conv"
)

// respType is the type of redis resp
Expand Down Expand Up @@ -135,10 +136,10 @@ func (r *resp) decodeInline(line []byte) (err error) {
r.rTp = respArray

for i, field := range fields {
r.array[i] = &resp {
rTp: respBulk,
data: []byte(fmt.Sprintf("%d\r\n%c", len(field), field)),
array: nil,
r.array[i] = &resp{
rTp: respBulk,
data: []byte(fmt.Sprintf("%d\r\n%c", len(field), field)),
array: nil,
arrayn: 0,
}
}
Expand Down
5 changes: 3 additions & 2 deletions proxy/config.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package proxy

import (
"fmt"
"strings"

"overlord/proto"

"github.com/BurntSushi/toml"
"github.com/pkg/errors"
"strings"
"fmt"
)

// Config proxy config.
Expand Down

0 comments on commit 34456dd

Please sign in to comment.