refactor, split ledis pkg to ledis and server

This commit is contained in:
siddontang 2014-05-16 15:03:23 +08:00
parent f9f7d24e58
commit a0f90016d4
20 changed files with 127 additions and 141 deletions

View File

@ -2,7 +2,7 @@ package main
import ( import (
"flag" "flag"
"github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/server"
"os" "os"
"os/signal" "os/signal"
"runtime" "runtime"
@ -20,13 +20,13 @@ func main() {
panic("must use a config file") panic("must use a config file")
} }
cfg, err := ledis.NewConfigWithFile(*configFile) cfg, err := server.NewConfigWithFile(*configFile)
if err != nil { if err != nil {
panic(err) panic(err)
} }
var app *ledis.App var app *server.App
app, err = ledis.NewApp(cfg) app, err = server.NewApp(cfg)
if err != nil { if err != nil {
panic(err) panic(err)
} }

41
ledis/db_test.go Normal file
View File

@ -0,0 +1,41 @@
package ledis
import (
"sync"
"testing"
)
var testDB *DB
var testDBOnce sync.Once
func getTestDB() *DB {
f := func() {
var d = []byte(`
{
"data_db" : {
"path" : "/tmp/testdb",
"compression":true,
"block_size" : 32768,
"write_buffer_size" : 2097152,
"cache_size" : 20971520
}
}
`)
db, err := OpenDB(d)
if err != nil {
println(err.Error())
panic(err)
}
testDB = db
testDB.db.Clear()
}
testDBOnce.Do(f)
return testDB
}
func TestDB(t *testing.T) {
getTestDB()
}

View File

@ -21,14 +21,14 @@ const (
func encode_hsize_key(key []byte) []byte { func encode_hsize_key(key []byte) []byte {
buf := make([]byte, len(key)+1) buf := make([]byte, len(key)+1)
buf[0] = HSIZE_TYPE buf[0] = hSizeType
copy(buf[1:], key) copy(buf[1:], key)
return buf return buf
} }
func decode_hsize_key(ek []byte) ([]byte, error) { func decode_hsize_key(ek []byte) ([]byte, error) {
if len(ek) == 0 || ek[0] != HSIZE_TYPE { if len(ek) == 0 || ek[0] != hSizeType {
return nil, errHSizeKey return nil, errHSizeKey
} }
@ -39,7 +39,7 @@ func encode_hash_key(key []byte, field []byte) []byte {
buf := make([]byte, len(key)+len(field)+1+4+1) buf := make([]byte, len(key)+len(field)+1+4+1)
pos := 0 pos := 0
buf[pos] = HASH_TYPE buf[pos] = hashType
pos++ pos++
binary.BigEndian.PutUint32(buf[pos:], uint32(len(key))) binary.BigEndian.PutUint32(buf[pos:], uint32(len(key)))
pos += 4 pos += 4
@ -68,7 +68,7 @@ func encode_hash_stop_key(key []byte) []byte {
} }
func decode_hash_key(ek []byte) ([]byte, []byte, error) { func decode_hash_key(ek []byte) ([]byte, []byte, error) {
if len(ek) < 6 || ek[0] != HASH_TYPE { if len(ek) < 6 || ek[0] != hashType {
return nil, nil, errHashKey return nil, nil, errHashKey
} }

View File

@ -13,13 +13,13 @@ var errKVKey = errors.New("invalid encode kv key")
func encode_kv_key(key []byte) []byte { func encode_kv_key(key []byte) []byte {
ek := make([]byte, len(key)+1) ek := make([]byte, len(key)+1)
ek[0] = KV_TYPE ek[0] = kvType
copy(ek[1:], key) copy(ek[1:], key)
return ek return ek
} }
func decode_kv_key(ek []byte) ([]byte, error) { func decode_kv_key(ek []byte) ([]byte, error) {
if len(ek) == 0 || ek[0] != KV_TYPE { if len(ek) == 0 || ek[0] != kvType {
return nil, errKVKey return nil, errKVKey
} }

View File

@ -21,14 +21,14 @@ var errListSeq = errors.New("invalid list sequence, overflow")
func encode_lmeta_key(key []byte) []byte { func encode_lmeta_key(key []byte) []byte {
buf := make([]byte, len(key)+1) buf := make([]byte, len(key)+1)
buf[0] = LMETA_TYPE buf[0] = lMetaType
copy(buf[1:], key) copy(buf[1:], key)
return buf return buf
} }
func decode_lmeta_key(ek []byte) ([]byte, error) { func decode_lmeta_key(ek []byte) ([]byte, error) {
if len(ek) == 0 || ek[0] != LMETA_TYPE { if len(ek) == 0 || ek[0] != lMetaType {
return nil, errLMetaKey return nil, errLMetaKey
} }
@ -39,7 +39,7 @@ func encode_list_key(key []byte, seq int32) []byte {
buf := make([]byte, len(key)+9) buf := make([]byte, len(key)+9)
pos := 0 pos := 0
buf[pos] = LIST_TYPE buf[pos] = listType
pos++ pos++
binary.BigEndian.PutUint32(buf[pos:], uint32(len(key))) binary.BigEndian.PutUint32(buf[pos:], uint32(len(key)))
@ -54,7 +54,7 @@ func encode_list_key(key []byte, seq int32) []byte {
} }
func decode_list_key(ek []byte) (key []byte, seq int32, err error) { func decode_list_key(ek []byte) (key []byte, seq int32, err error) {
if len(ek) < 9 || ek[0] != LIST_TYPE { if len(ek) < 9 || ek[0] != listType {
err = errListKey err = errListKey
return return
} }

View File

@ -20,6 +20,7 @@ type ScorePair struct {
var errZSizeKey = errors.New("invalid zsize key") var errZSizeKey = errors.New("invalid zsize key")
var errZSetKey = errors.New("invalid zset key") var errZSetKey = errors.New("invalid zset key")
var errZScoreKey = errors.New("invalid zscore key") var errZScoreKey = errors.New("invalid zscore key")
var errScoreOverflow = errors.New("zset score overflow")
const ( const (
zsetNScoreSep byte = '<' zsetNScoreSep byte = '<'
@ -32,14 +33,14 @@ const (
func encode_zsize_key(key []byte) []byte { func encode_zsize_key(key []byte) []byte {
buf := make([]byte, len(key)+1) buf := make([]byte, len(key)+1)
buf[0] = ZSIZE_TYPE buf[0] = zSizeType
copy(buf[1:], key) copy(buf[1:], key)
return buf return buf
} }
func decode_zsize_key(ek []byte) ([]byte, error) { func decode_zsize_key(ek []byte) ([]byte, error) {
if len(ek) == 0 || ek[0] != ZSIZE_TYPE { if len(ek) == 0 || ek[0] != zSizeType {
return nil, errZSizeKey return nil, errZSizeKey
} }
@ -50,7 +51,7 @@ func encode_zset_key(key []byte, member []byte) []byte {
buf := make([]byte, len(key)+len(member)+5) buf := make([]byte, len(key)+len(member)+5)
pos := 0 pos := 0
buf[pos] = ZSET_TYPE buf[pos] = zsetType
pos++ pos++
binary.BigEndian.PutUint32(buf[pos:], uint32(len(key))) binary.BigEndian.PutUint32(buf[pos:], uint32(len(key)))
@ -65,7 +66,7 @@ func encode_zset_key(key []byte, member []byte) []byte {
} }
func decode_zset_key(ek []byte) ([]byte, []byte, error) { func decode_zset_key(ek []byte) ([]byte, []byte, error) {
if len(ek) < 5 || ek[0] != ZSET_TYPE { if len(ek) < 5 || ek[0] != zsetType {
return nil, nil, errZSetKey return nil, nil, errZSetKey
} }
@ -83,7 +84,7 @@ func encode_zscore_key(key []byte, member []byte, score int64) []byte {
buf := make([]byte, len(key)+len(member)+15) buf := make([]byte, len(key)+len(member)+15)
pos := 0 pos := 0
buf[pos] = ZSCORE_TYPE buf[pos] = zScoreType
pos++ pos++
binary.BigEndian.PutUint32(buf[pos:], uint32(len(key))) binary.BigEndian.PutUint32(buf[pos:], uint32(len(key)))
@ -121,7 +122,7 @@ func encode_stop_zscore_key(key []byte, score int64) []byte {
} }
func decode_zscore_key(ek []byte) (key []byte, member []byte, score int64, err error) { func decode_zscore_key(ek []byte) (key []byte, member []byte, score int64, err error) {
if len(ek) < 15 || ek[0] != ZSCORE_TYPE { if len(ek) < 15 || ek[0] != zScoreType {
err = errZScoreKey err = errZScoreKey
return return
} }

View File

@ -1,6 +1,7 @@
package ledis package server
import ( import (
"github.com/siddontang/ledisdb/ledis"
"net" "net"
"strings" "strings"
) )
@ -10,7 +11,7 @@ type App struct {
listener net.Listener listener net.Listener
db *DB db *ledis.DB
closed bool closed bool
} }
@ -34,7 +35,7 @@ func NewApp(cfg *Config) (*App, error) {
return nil, err return nil, err
} }
app.db, err = OpenDBWithConfig(&cfg.DB) app.db, err = ledis.OpenDBWithConfig(&cfg.DB)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -1,4 +1,4 @@
package ledis package server
import ( import (
"github.com/garyburd/redigo/redis" "github.com/garyburd/redigo/redis"
@ -30,12 +30,6 @@ func getTestConn() redis.Conn {
return testPool.Get() return testPool.Get()
} }
func getTestDB() *DB {
startTestApp()
return testApp.db
}
func startTestApp() { func startTestApp() {
f := func() { f := func() {
newTestRedisPool() newTestRedisPool()

View File

@ -1,9 +1,10 @@
package ledis package server
import ( import (
"bufio" "bufio"
"errors" "errors"
"github.com/siddontang/golib/log" "github.com/siddontang/golib/log"
"github.com/siddontang/ledisdb/ledis"
"io" "io"
"net" "net"
"runtime" "runtime"
@ -14,7 +15,7 @@ import (
var errReadRequest = errors.New("invalid request protocol") var errReadRequest = errors.New("invalid request protocol")
type client struct { type client struct {
db *DB db *ledis.DB
c net.Conn c net.Conn
rb *bufio.Reader rb *bufio.Reader
@ -26,7 +27,7 @@ type client struct {
reqC chan error reqC chan error
} }
func newClient(c net.Conn, db *DB) { func newClient(c net.Conn, db *ledis.DB) {
co := new(client) co := new(client)
co.db = db co.db = db
co.c = c co.c = c
@ -91,7 +92,7 @@ func (c *client) readRequest() ([][]byte, error) {
} }
var nparams int var nparams int
if nparams, err = strconv.Atoi(String(l[1:])); err != nil { if nparams, err = strconv.Atoi(ledis.String(l[1:])); err != nil {
return nil, err return nil, err
} else if nparams <= 0 { } else if nparams <= 0 {
return nil, errReadRequest return nil, errReadRequest
@ -108,7 +109,7 @@ func (c *client) readRequest() ([][]byte, error) {
return nil, errReadRequest return nil, errReadRequest
} else if l[0] == '$' { } else if l[0] == '$' {
//handle resp string //handle resp string
if n, err = strconv.Atoi(String(l[1:])); err != nil { if n, err = strconv.Atoi(ledis.String(l[1:])); err != nil {
return nil, err return nil, err
} else if n == -1 { } else if n == -1 {
req = append(req, nil) req = append(req, nil)
@ -138,7 +139,7 @@ func (c *client) handleRequest(req [][]byte) {
if len(req) == 0 { if len(req) == 0 {
err = ErrEmptyCommand err = ErrEmptyCommand
} else { } else {
c.cmd = strings.ToLower(String(req[0])) c.cmd = strings.ToLower(ledis.String(req[0]))
c.args = req[1:] c.args = req[1:]
f, ok := regCmds[c.cmd] f, ok := regCmds[c.cmd]
@ -160,23 +161,23 @@ func (c *client) handleRequest(req [][]byte) {
} }
func (c *client) writeError(err error) { func (c *client) writeError(err error) {
c.wb.Write(Slice("-ERR")) c.wb.Write(ledis.Slice("-ERR"))
if err != nil { if err != nil {
c.wb.WriteByte(' ') c.wb.WriteByte(' ')
c.wb.Write(Slice(err.Error())) c.wb.Write(ledis.Slice(err.Error()))
} }
c.wb.Write(Delims) c.wb.Write(Delims)
} }
func (c *client) writeStatus(status string) { func (c *client) writeStatus(status string) {
c.wb.WriteByte('+') c.wb.WriteByte('+')
c.wb.Write(Slice(status)) c.wb.Write(ledis.Slice(status))
c.wb.Write(Delims) c.wb.Write(Delims)
} }
func (c *client) writeInteger(n int64) { func (c *client) writeInteger(n int64) {
c.wb.WriteByte(':') c.wb.WriteByte(':')
c.wb.Write(StrPutInt64(n)) c.wb.Write(ledis.StrPutInt64(n))
c.wb.Write(Delims) c.wb.Write(Delims)
} }
@ -185,7 +186,7 @@ func (c *client) writeBulk(b []byte) {
if b == nil { if b == nil {
c.wb.Write(NullBulk) c.wb.Write(NullBulk)
} else { } else {
c.wb.Write(Slice(strconv.Itoa(len(b)))) c.wb.Write(ledis.Slice(strconv.Itoa(len(b))))
c.wb.Write(Delims) c.wb.Write(Delims)
c.wb.Write(b) c.wb.Write(b)
} }
@ -199,7 +200,7 @@ func (c *client) writeArray(ay []interface{}) {
c.wb.Write(NullArray) c.wb.Write(NullArray)
c.wb.Write(Delims) c.wb.Write(Delims)
} else { } else {
c.wb.Write(Slice(strconv.Itoa(len(ay)))) c.wb.Write(ledis.Slice(strconv.Itoa(len(ay))))
c.wb.Write(Delims) c.wb.Write(Delims)
for i := 0; i < len(ay); i++ { for i := 0; i < len(ay); i++ {

View File

@ -1,6 +1,8 @@
package ledis package server
import () import (
"github.com/siddontang/ledisdb/ledis"
)
func hsetCommand(c *client) error { func hsetCommand(c *client) error {
args := c.args args := c.args
@ -87,7 +89,7 @@ func hincrbyCommand(c *client) error {
return ErrCmdParams return ErrCmdParams
} }
delta, err := StrInt64(args[2], nil) delta, err := ledis.StrInt64(args[2], nil)
if err != nil { if err != nil {
return err return err
} }
@ -115,7 +117,7 @@ func hmsetCommand(c *client) error {
args = args[1:] args = args[1:]
kvs := make([]FVPair, len(args)/2) kvs := make([]ledis.FVPair, len(args)/2)
for i := 0; i < len(kvs); i++ { for i := 0; i < len(kvs); i++ {
kvs[i].Field = args[2*i] kvs[i].Field = args[2*i]
kvs[i].Value = args[2*i+1] kvs[i].Value = args[2*i+1]

View File

@ -1,4 +1,4 @@
package ledis package server
import ( import (
"fmt" "fmt"

View File

@ -1,6 +1,8 @@
package ledis package server
import () import (
"github.com/siddontang/ledisdb/ledis"
)
func getCommand(c *client) error { func getCommand(c *client) error {
args := c.args args := c.args
@ -112,7 +114,7 @@ func incrbyCommand(c *client) error {
return ErrCmdParams return ErrCmdParams
} }
delta, err := StrInt64(args[1], nil) delta, err := ledis.StrInt64(args[1], nil)
if err != nil { if err != nil {
return err return err
} }
@ -132,7 +134,7 @@ func decrbyCommand(c *client) error {
return ErrCmdParams return ErrCmdParams
} }
delta, err := StrInt64(args[1], nil) delta, err := ledis.StrInt64(args[1], nil)
if err != nil { if err != nil {
return err return err
} }
@ -167,7 +169,7 @@ func msetCommand(c *client) error {
return ErrCmdParams return ErrCmdParams
} }
kvs := make([]KVPair, len(args)/2) kvs := make([]ledis.KVPair, len(args)/2)
for i := 0; i < len(kvs); i++ { for i := 0; i < len(kvs); i++ {
kvs[i].Key = args[2*i] kvs[i].Key = args[2*i]
kvs[i].Value = args[2*i+1] kvs[i].Value = args[2*i+1]

View File

@ -1,4 +1,4 @@
package ledis package server
import ( import (
"github.com/garyburd/redigo/redis" "github.com/garyburd/redigo/redis"

View File

@ -1,6 +1,8 @@
package ledis package server
import () import (
"github.com/siddontang/ledisdb/ledis"
)
func lpushCommand(c *client) error { func lpushCommand(c *client) error {
args := c.args args := c.args
@ -83,7 +85,7 @@ func lindexCommand(c *client) error {
return ErrCmdParams return ErrCmdParams
} }
index, err := StrInt64(args[1], nil) index, err := ledis.StrInt64(args[1], nil)
if err != nil { if err != nil {
return err return err
} }
@ -107,12 +109,12 @@ func lrangeCommand(c *client) error {
var stop int64 var stop int64
var err error var err error
start, err = StrInt64(args[1], nil) start, err = ledis.StrInt64(args[1], nil)
if err != nil { if err != nil {
return err return err
} }
stop, err = StrInt64(args[2], nil) stop, err = ledis.StrInt64(args[2], nil)
if err != nil { if err != nil {
return err return err
} }

View File

@ -1,4 +1,4 @@
package ledis package server
import ( import (
"fmt" "fmt"

View File

@ -1,7 +1,8 @@
package ledis package server
import ( import (
"errors" "errors"
"github.com/siddontang/ledisdb/ledis"
"math" "math"
"strconv" "strconv"
"strings" "strings"
@ -24,9 +25,9 @@ func zaddCommand(c *client) error {
args = args[1:] args = args[1:]
params := make([]ScorePair, len(args)/2) params := make([]ledis.ScorePair, len(args)/2)
for i := 0; i < len(params); i++ { for i := 0; i < len(params); i++ {
score, err := StrInt64(args[2*i], nil) score, err := ledis.StrInt64(args[2*i], nil)
if err != nil { if err != nil {
return err return err
} }
@ -97,7 +98,7 @@ func zincrbyCommand(c *client) error {
key := args[0] key := args[0]
delta, err := StrInt64(args[1], nil) delta, err := ledis.StrInt64(args[1], nil)
if err != nil { if err != nil {
return err return err
} }
@ -112,7 +113,7 @@ func zincrbyCommand(c *client) error {
} }
func zparseScoreRange(minBuf []byte, maxBuf []byte) (min int64, max int64, err error) { func zparseScoreRange(minBuf []byte, maxBuf []byte) (min int64, max int64, err error) {
if strings.ToLower(String(minBuf)) == "-inf" { if strings.ToLower(ledis.String(minBuf)) == "-inf" {
min = math.MinInt64 min = math.MinInt64
} else { } else {
var lopen bool = false var lopen bool = false
@ -126,12 +127,12 @@ func zparseScoreRange(minBuf []byte, maxBuf []byte) (min int64, max int64, err e
return return
} }
min, err = StrInt64(minBuf, nil) min, err = ledis.StrInt64(minBuf, nil)
if err != nil { if err != nil {
return return
} }
if min <= MinScore || min >= MaxScore { if min <= ledis.MinScore || min >= ledis.MaxScore {
err = errScoreOverflow err = errScoreOverflow
return return
} }
@ -141,7 +142,7 @@ func zparseScoreRange(minBuf []byte, maxBuf []byte) (min int64, max int64, err e
} }
} }
if strings.ToLower(String(maxBuf)) == "+inf" { if strings.ToLower(ledis.String(maxBuf)) == "+inf" {
max = math.MaxInt64 max = math.MaxInt64
} else { } else {
var ropen = false var ropen = false
@ -155,12 +156,12 @@ func zparseScoreRange(minBuf []byte, maxBuf []byte) (min int64, max int64, err e
return return
} }
max, err = StrInt64(maxBuf, nil) max, err = ledis.StrInt64(maxBuf, nil)
if err != nil { if err != nil {
return return
} }
if max <= MinScore || max >= MaxScore { if max <= ledis.MinScore || max >= ledis.MaxScore {
err = errScoreOverflow err = errScoreOverflow
return return
} }
@ -276,11 +277,11 @@ func zremrangebyscoreCommand(c *client) error {
} }
func zparseRange(c *client, a1 []byte, a2 []byte) (start int, stop int, err error) { func zparseRange(c *client, a1 []byte, a2 []byte) (start int, stop int, err error) {
if start, err = strconv.Atoi(String(a1)); err != nil { if start, err = strconv.Atoi(ledis.String(a1)); err != nil {
return return
} }
if stop, err = strconv.Atoi(String(a2)); err != nil { if stop, err = strconv.Atoi(ledis.String(a2)); err != nil {
return return
} }
@ -303,7 +304,7 @@ func zrangeGeneric(c *client, reverse bool) error {
args = args[3:] args = args[3:]
var withScores bool = false var withScores bool = false
if len(args) > 0 && strings.ToLower(String(args[0])) == "withscores" { if len(args) > 0 && strings.ToLower(ledis.String(args[0])) == "withscores" {
withScores = true withScores = true
} }
@ -339,7 +340,7 @@ func zrangebyscoreGeneric(c *client, reverse bool) error {
var withScores bool = false var withScores bool = false
if len(args) > 0 && strings.ToLower(String(args[0])) == "withscores" { if len(args) > 0 && strings.ToLower(ledis.String(args[0])) == "withscores" {
withScores = true withScores = true
args = args[1:] args = args[1:]
} }
@ -352,15 +353,15 @@ func zrangebyscoreGeneric(c *client, reverse bool) error {
return ErrCmdParams return ErrCmdParams
} }
if strings.ToLower(String(args[0])) != "limit" { if strings.ToLower(ledis.String(args[0])) != "limit" {
return ErrCmdParams return ErrCmdParams
} }
if offset, err = strconv.Atoi(String(args[1])); err != nil { if offset, err = strconv.Atoi(ledis.String(args[1])); err != nil {
return ErrCmdParams return ErrCmdParams
} }
if count, err = strconv.Atoi(String(args[2])); err != nil { if count, err = strconv.Atoi(ledis.String(args[2])); err != nil {
return ErrCmdParams return ErrCmdParams
} }
} }

View File

@ -1,61 +1,12 @@
package ledis package server
import ( import (
"bytes"
"fmt" "fmt"
"github.com/garyburd/redigo/redis" "github.com/garyburd/redigo/redis"
"strconv" "strconv"
"testing" "testing"
) )
func TestCodecZSet(t *testing.T) {
key := []byte("a")
ek := encode_zsize_key(key)
if k, err := decode_zsize_key(ek); err != nil {
t.Fatal(err)
} else if !bytes.Equal(key, k) {
t.Fatal(string(k))
}
member := []byte("f")
ek = encode_zset_key(key, member)
if k, m, err := decode_zset_key(ek); err != nil {
t.Fatal(err)
} else if !bytes.Equal(key, k) {
t.Fatal(string(k))
} else if !bytes.Equal(member, m) {
t.Fatal(string(m))
}
ek = encode_zscore_key(key, member, 3)
if k, m, s, err := decode_zscore_key(ek); err != nil {
t.Fatal(err)
} else if !bytes.Equal(key, k) {
t.Fatal(string(k))
} else if !bytes.Equal(member, m) {
t.Fatal(string(m))
} else if s != 3 {
t.Fatal(s)
}
ek = encode_zscore_key(key, member, -3)
if k, m, s, err := decode_zscore_key(ek); err != nil {
t.Fatal(err)
} else if !bytes.Equal(key, k) {
t.Fatal(string(k))
} else if !bytes.Equal(member, m) {
t.Fatal(string(m))
} else if s != -3 {
t.Fatal(s)
}
}
func TestZSet(t *testing.T) { func TestZSet(t *testing.T) {
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()

View File

@ -1,4 +1,4 @@
package ledis package server
import ( import (
"fmt" "fmt"

View File

@ -1,14 +1,15 @@
package ledis package server
import ( import (
"encoding/json" "encoding/json"
"github.com/siddontang/ledisdb/ledis"
"io/ioutil" "io/ioutil"
) )
type Config struct { type Config struct {
Addr string `json:"addr"` Addr string `json:"addr"`
DB DBConfig `json:"db"` DB ledis.DBConfig `json:"db"`
} }
func NewConfig(data json.RawMessage) (*Config, error) { func NewConfig(data json.RawMessage) (*Config, error) {

View File

@ -1,4 +1,4 @@
package ledis package server
import ( import (
"errors" "errors"
@ -19,14 +19,3 @@ var (
PONG = "PONG" PONG = "PONG"
OK = "OK" OK = "OK"
) )
const (
KV_TYPE byte = iota + 1
HASH_TYPE
HSIZE_TYPE
LIST_TYPE
LMETA_TYPE
ZSET_TYPE
ZSIZE_TYPE
ZSCORE_TYPE
)