Merge branch 'develop'

This commit is contained in:
siddontang 2015-05-12 09:03:50 +08:00
commit 1bb1caef09
83 changed files with 213 additions and 132 deletions

View File

@ -42,4 +42,5 @@ clean:
$(GO) clean -i ./... $(GO) clean -i ./...
fmt: fmt:
go fmt ./... gofmt -w=true cmd config ledis rpl server store vendor
goimports -w=true cmd config ledis rpl server store vendor

View File

@ -3,13 +3,14 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"github.com/siddontang/goredis"
"math/rand" "math/rand"
"runtime" "runtime"
"strings" "strings"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/siddontang/goredis"
) )
var ip = flag.String("ip", "127.0.0.1", "redis/ledis/ssdb server ip") var ip = flag.String("ip", "127.0.0.1", "redis/ledis/ssdb server ip")

View File

@ -1,4 +1,4 @@
//This file was generated by .tools/generate_commands.py on Sat Mar 14 2015 08:58:32 +0800 //This file was generated by .tools/generate_commands.py on Sat Mar 14 2015 08:58:32 +0800
package main package main
var helpCommands = [][]string{ var helpCommands = [][]string{

View File

@ -5,10 +5,11 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"github.com/siddontang/goredis"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
"github.com/siddontang/goredis"
) )
var ip = flag.String("h", "127.0.0.1", "ledisdb server ip (default 127.0.0.1)") var ip = flag.String("h", "127.0.0.1", "ledisdb server ip (default 127.0.0.1)")

View File

@ -3,8 +3,9 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"github.com/siddontang/goredis"
"os" "os"
"github.com/siddontang/goredis"
) )
var host = flag.String("host", "127.0.0.1", "ledis server host") var host = flag.String("host", "127.0.0.1", "ledis server host")

View File

@ -2,6 +2,7 @@ package main
import ( import (
"flag" "flag"
"github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/ledis"
) )

View File

@ -2,6 +2,7 @@ package main
import ( import (
"flag" "flag"
"github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store" "github.com/siddontang/ledisdb/store"
) )

View File

@ -3,8 +3,6 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/server"
"log" "log"
"net/http" "net/http"
_ "net/http/pprof" _ "net/http/pprof"
@ -13,6 +11,9 @@ import (
"runtime" "runtime"
"strings" "strings"
"syscall" "syscall"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/server"
) )
var configFile = flag.String("config", "", "ledisdb config file") var configFile = flag.String("config", "", "ledisdb config file")

View File

@ -3,11 +3,12 @@ package config
import ( import (
"bytes" "bytes"
"errors" "errors"
"github.com/BurntSushi/toml"
"github.com/siddontang/go/ioutil2"
"io" "io"
"io/ioutil" "io/ioutil"
"sync" "sync"
"github.com/BurntSushi/toml"
"github.com/siddontang/go/ioutil2"
) )
var ( var (

View File

@ -1,10 +1,11 @@
package ledis package ledis
import ( import (
"sync"
"github.com/siddontang/go/log" "github.com/siddontang/go/log"
"github.com/siddontang/ledisdb/rpl" "github.com/siddontang/ledisdb/rpl"
"github.com/siddontang/ledisdb/store" "github.com/siddontang/ledisdb/store"
"sync"
) )
type batch struct { type batch struct {

View File

@ -4,10 +4,11 @@ import (
"bufio" "bufio"
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"github.com/siddontang/go/snappy"
"github.com/siddontang/ledisdb/store"
"io" "io"
"os" "os"
"github.com/siddontang/go/snappy"
"github.com/siddontang/ledisdb/store"
) )
type DumpHead struct { type DumpHead struct {

View File

@ -2,10 +2,11 @@ package ledis
import ( import (
"bytes" "bytes"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store"
"os" "os"
"testing" "testing"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store"
) )
func TestDump(t *testing.T) { func TestDump(t *testing.T) {

View File

@ -3,8 +3,9 @@ package ledis
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/siddontang/go/hack"
"strconv" "strconv"
"github.com/siddontang/go/hack"
) )
var errInvalidEvent = errors.New("invalid event") var errInvalidEvent = errors.New("invalid event")

View File

@ -2,16 +2,17 @@ package ledis
import ( import (
"fmt" "fmt"
"github.com/siddontang/go/filelock"
"github.com/siddontang/go/log"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/rpl"
"github.com/siddontang/ledisdb/store"
"io" "io"
"os" "os"
"path" "path"
"sync" "sync"
"time" "time"
"github.com/siddontang/go/filelock"
"github.com/siddontang/go/log"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/rpl"
"github.com/siddontang/ledisdb/store"
) )
type Ledis struct { type Ledis struct {

View File

@ -4,8 +4,9 @@ import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"github.com/siddontang/ledisdb/store"
"sync" "sync"
"github.com/siddontang/ledisdb/store"
) )
type ibucket interface { type ibucket interface {

View File

@ -1,10 +1,11 @@
package ledis package ledis
import ( import (
"github.com/siddontang/ledisdb/config"
"os" "os"
"sync" "sync"
"testing" "testing"
"github.com/siddontang/ledisdb/config"
) )
var testLedis *Ledis var testLedis *Ledis

View File

@ -2,6 +2,7 @@ package ledis
import ( import (
"fmt" "fmt"
"github.com/siddontang/rdb" "github.com/siddontang/rdb"
) )

View File

@ -1,9 +1,10 @@
package ledis package ledis
import ( import (
"github.com/siddontang/ledisdb/config"
"os" "os"
"testing" "testing"
"github.com/siddontang/ledisdb/config"
) )
func TestMigrate(t *testing.T) { func TestMigrate(t *testing.T) {

View File

@ -3,12 +3,13 @@ package ledis
import ( import (
"bytes" "bytes"
"errors" "errors"
"io"
"time"
"github.com/siddontang/go/log" "github.com/siddontang/go/log"
"github.com/siddontang/go/snappy" "github.com/siddontang/go/snappy"
"github.com/siddontang/ledisdb/rpl" "github.com/siddontang/ledisdb/rpl"
"github.com/siddontang/ledisdb/store" "github.com/siddontang/ledisdb/store"
"io"
"time"
) )
const ( const (

View File

@ -3,10 +3,11 @@ package ledis
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store"
"os" "os"
"testing" "testing"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store"
) )
func checkLedisEqual(master *Ledis, slave *Ledis) error { func checkLedisEqual(master *Ledis, slave *Ledis) error {

View File

@ -2,8 +2,9 @@ package ledis
import ( import (
"errors" "errors"
"github.com/siddontang/ledisdb/store"
"regexp" "regexp"
"github.com/siddontang/ledisdb/store"
) )
var errDataType = errors.New("error data type") var errDataType = errors.New("error data type")

View File

@ -3,9 +3,10 @@ package ledis
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/siddontang/ledisdb/store"
"sort" "sort"
"strconv" "strconv"
"github.com/siddontang/ledisdb/store"
) )
type Limit struct { type Limit struct {

View File

@ -3,9 +3,10 @@ package ledis
import ( import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"time"
"github.com/siddontang/go/num" "github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/store" "github.com/siddontang/ledisdb/store"
"time"
) )
type FVPair struct { type FVPair struct {

View File

@ -4,10 +4,11 @@ import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"fmt" "fmt"
"github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/store"
"strings" "strings"
"time" "time"
"github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/store"
) )
type KVPair struct { type KVPair struct {

View File

@ -4,10 +4,11 @@ import (
"container/list" "container/list"
"encoding/binary" "encoding/binary"
"errors" "errors"
"github.com/siddontang/go/hack"
"github.com/siddontang/ledisdb/store"
"sync" "sync"
"time" "time"
"github.com/siddontang/go/hack"
"github.com/siddontang/ledisdb/store"
) )
const ( const (

View File

@ -3,9 +3,10 @@ package ledis
import ( import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"time"
"github.com/siddontang/go/hack" "github.com/siddontang/go/hack"
"github.com/siddontang/ledisdb/store" "github.com/siddontang/ledisdb/store"
"time"
) )
var errSetKey = errors.New("invalid set key") var errSetKey = errors.New("invalid set key")

View File

@ -3,9 +3,10 @@ package ledis
import ( import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"github.com/siddontang/ledisdb/store"
"sync" "sync"
"time" "time"
"github.com/siddontang/ledisdb/store"
) )
var ( var (

View File

@ -2,10 +2,11 @@ package ledis
import ( import (
"fmt" "fmt"
"github.com/siddontang/go/hack"
"sync" "sync"
"testing" "testing"
"time" "time"
"github.com/siddontang/go/hack"
) )
var m sync.Mutex var m sync.Mutex

View File

@ -4,9 +4,10 @@ import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"errors" "errors"
"time"
"github.com/siddontang/go/hack" "github.com/siddontang/go/hack"
"github.com/siddontang/ledisdb/store" "github.com/siddontang/ledisdb/store"
"time"
) )
const ( const (
@ -582,9 +583,10 @@ func (db *DB) zRange(key []byte, min int64, max int64, offset int, count int, re
return []ScorePair{}, nil return []ScorePair{}, nil
} }
nv := 64 nv := count
if count > 0 { // count may be very large, so we must limit it for below mem make.
nv = count if nv <= 0 || nv > 1024 {
nv = 64
} }
v := make([]ScorePair, 0, nv) v := make([]ScorePair, 0, nv)

View File

@ -2,9 +2,10 @@ package ledis
import ( import (
"fmt" "fmt"
"github.com/siddontang/ledisdb/store"
"reflect" "reflect"
"testing" "testing"
"github.com/siddontang/ledisdb/store"
) )
const ( const (

View File

@ -3,8 +3,9 @@ package ledis
import ( import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"github.com/siddontang/go/hack"
"strconv" "strconv"
"github.com/siddontang/go/hack"
) )
var errIntNumber = errors.New("invalid integer") var errIntNumber = errors.New("invalid integer")

View File

@ -2,10 +2,11 @@ package rpl
import ( import (
"fmt" "fmt"
"github.com/edsrzf/mmap-go"
"github.com/siddontang/go/log"
"io" "io"
"os" "os"
"github.com/edsrzf/mmap-go"
"github.com/siddontang/go/log"
) )
//like leveldb or rocksdb file interface, haha! //like leveldb or rocksdb file interface, haha!

View File

@ -2,14 +2,15 @@ package rpl
import ( import (
"fmt" "fmt"
"github.com/siddontang/go/log"
"github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/config"
"io/ioutil" "io/ioutil"
"os" "os"
"sort" "sort"
"sync" "sync"
"time" "time"
"github.com/siddontang/go/log"
"github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/config"
) )
const ( const (

View File

@ -5,12 +5,13 @@ import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"fmt" "fmt"
"github.com/siddontang/go/log"
"github.com/siddontang/go/sync2"
"io" "io"
"path" "path"
"sync" "sync"
"time" "time"
"github.com/siddontang/go/log"
"github.com/siddontang/go/sync2"
) )
var ( var (

View File

@ -1,12 +1,13 @@
package rpl package rpl
import ( import (
"github.com/siddontang/go/log"
"io/ioutil" "io/ioutil"
"os" "os"
"path" "path"
"testing" "testing"
"time" "time"
"github.com/siddontang/go/log"
) )
func TestFileTable(t *testing.T) { func TestFileTable(t *testing.T) {

View File

@ -3,12 +3,13 @@ package rpl
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store"
"os" "os"
"sync" "sync"
"time" "time"
"github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store"
) )
type GoLevelDBStore struct { type GoLevelDBStore struct {

View File

@ -2,13 +2,14 @@ package rpl
import ( import (
"encoding/binary" "encoding/binary"
"github.com/siddontang/go/log"
"github.com/siddontang/go/snappy"
"github.com/siddontang/ledisdb/config"
"os" "os"
"path" "path"
"sync" "sync"
"time" "time"
"github.com/siddontang/go/log"
"github.com/siddontang/go/snappy"
"github.com/siddontang/ledisdb/config"
) )
type Stat struct { type Stat struct {

View File

@ -1,10 +1,11 @@
package rpl package rpl
import ( import (
"github.com/siddontang/ledisdb/config"
"io/ioutil" "io/ioutil"
"os" "os"
"testing" "testing"
"github.com/siddontang/ledisdb/config"
) )
func TestReplication(t *testing.T) { func TestReplication(t *testing.T) {

View File

@ -1,10 +1,11 @@
package rpl package rpl
import ( import (
"github.com/siddontang/ledisdb/config"
"io/ioutil" "io/ioutil"
"os" "os"
"testing" "testing"
"github.com/siddontang/ledisdb/config"
) )
func TestGoLevelDBStore(t *testing.T) { func TestGoLevelDBStore(t *testing.T) {

View File

@ -1,14 +1,15 @@
package server package server
import ( import (
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/ledis"
"net" "net"
"net/http" "net/http"
"path" "path"
"strings" "strings"
"sync" "sync"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/ledis"
) )
type App struct { type App struct {

View File

@ -1,11 +1,12 @@
package server package server
import ( import (
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/config"
"os" "os"
"sync" "sync"
"testing" "testing"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/config"
) )
var testAppOnce sync.Once var testAppOnce sync.Once

View File

@ -3,10 +3,11 @@ package server
import ( import (
"bytes" "bytes"
// "fmt" // "fmt"
"github.com/siddontang/go/sync2"
"github.com/siddontang/ledisdb/ledis"
"io" "io"
"time" "time"
"github.com/siddontang/go/sync2"
"github.com/siddontang/ledisdb/ledis"
) )
// var txUnsupportedCmds = map[string]struct{}{ // var txUnsupportedCmds = map[string]struct{}{

View File

@ -3,15 +3,16 @@ package server
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io"
"net/http"
"strconv"
"strings"
"github.com/siddontang/go/bson" "github.com/siddontang/go/bson"
"github.com/siddontang/go/hack" "github.com/siddontang/go/hack"
"github.com/siddontang/go/log" "github.com/siddontang/go/log"
"github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/ledis"
"github.com/ugorji/go/codec" "github.com/ugorji/go/codec"
"io"
"net/http"
"strconv"
"strings"
) )
var allowedContentTypes = map[string]struct{}{ var allowedContentTypes = map[string]struct{}{

View File

@ -4,17 +4,18 @@ import (
"bufio" "bufio"
"errors" "errors"
"fmt" "fmt"
"github.com/siddontang/go/hack"
"github.com/siddontang/go/log"
"github.com/siddontang/go/num"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/ledis"
"io" "io"
"net" "net"
"runtime" "runtime"
"strconv" "strconv"
"syscall" "syscall"
"time" "time"
"github.com/siddontang/go/hack"
"github.com/siddontang/go/log"
"github.com/siddontang/go/num"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/ledis"
) )
var errReadRequest = errors.New("invalid request protocol") var errReadRequest = errors.New("invalid request protocol")

View File

@ -2,9 +2,10 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/goredis"
"strconv" "strconv"
"testing" "testing"
"github.com/siddontang/goredis"
) )
func TestHash(t *testing.T) { func TestHash(t *testing.T) {

View File

@ -1,8 +1,9 @@
package server package server
import ( import (
"github.com/siddontang/ledisdb/ledis"
"strconv" "strconv"
"github.com/siddontang/ledisdb/ledis"
) )
// func getCommand(c *client) error { // func getCommand(c *client) error {

View File

@ -1,8 +1,9 @@
package server package server
import ( import (
"github.com/siddontang/goredis"
"testing" "testing"
"github.com/siddontang/goredis"
) )
func TestKV(t *testing.T) { func TestKV(t *testing.T) {

View File

@ -1,10 +1,11 @@
package server package server
import ( import (
"github.com/siddontang/go/hack"
"github.com/siddontang/ledisdb/ledis"
"strconv" "strconv"
"time" "time"
"github.com/siddontang/go/hack"
"github.com/siddontang/ledisdb/ledis"
) )
func lpushCommand(c *client) error { func lpushCommand(c *client) error {

View File

@ -2,9 +2,10 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/goredis"
"strconv" "strconv"
"testing" "testing"
"github.com/siddontang/goredis"
) )
func testListIndex(key []byte, index int64, v int) error { func testListIndex(key []byte, index int64, v int) error {

View File

@ -2,11 +2,12 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/config"
"os" "os"
"testing" "testing"
"time" "time"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/config"
) )
func TestDumpRestore(t *testing.T) { func TestDumpRestore(t *testing.T) {

View File

@ -3,13 +3,14 @@ package server
import ( import (
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"github.com/siddontang/go/hack"
"github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/ledis"
"net" "net"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/siddontang/go/hack"
"github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/ledis"
) )
func slaveofCommand(c *client) error { func slaveofCommand(c *client) error {

View File

@ -2,12 +2,13 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/config"
"os" "os"
"reflect" "reflect"
"testing" "testing"
"time" "time"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/config"
) )
func checkDataEqual(master *App, slave *App) error { func checkDataEqual(master *App, slave *App) error {

View File

@ -2,11 +2,12 @@ package server
import ( import (
"fmt" "fmt"
"strconv"
"strings"
"github.com/siddontang/go/hack" "github.com/siddontang/go/hack"
"github.com/siddontang/go/num" "github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/ledis"
"strconv"
"strings"
) )
func parseScanArgs(args [][]byte) (cursor []byte, match string, count int, desc bool, err error) { func parseScanArgs(args [][]byte) (cursor []byte, match string, count int, desc bool, err error) {

View File

@ -2,10 +2,11 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/config"
"os" "os"
"testing" "testing"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/config"
) )
func TestScan(t *testing.T) { func TestScan(t *testing.T) {

View File

@ -6,11 +6,13 @@ import (
"crypto/sha1" "crypto/sha1"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"github.com/siddontang/go/hack" "github.com/siddontang/go/hack"
"github.com/siddontang/ledisdb/vendor/lua"
"strconv" "strconv"
"strings" "strings"
"github.com/siddontang/ledisdb/vendor/lua"
) )
func parseEvalArgs(l *lua.State, c *client) error { func parseEvalArgs(l *lua.State, c *client) error {

View File

@ -4,9 +4,10 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/goredis"
"reflect" "reflect"
"testing" "testing"
"github.com/siddontang/goredis"
) )
func TestCmdEval(t *testing.T) { func TestCmdEval(t *testing.T) {

View File

@ -1,8 +1,9 @@
package server package server
import ( import (
"github.com/siddontang/goredis"
"testing" "testing"
"github.com/siddontang/goredis"
) )
func TestXSelect(t *testing.T) { func TestXSelect(t *testing.T) {

View File

@ -1,8 +1,9 @@
package server package server
import ( import (
"github.com/siddontang/goredis"
"testing" "testing"
"github.com/siddontang/goredis"
) )
func TestSet(t *testing.T) { func TestSet(t *testing.T) {

View File

@ -2,8 +2,9 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/goredis"
"testing" "testing"
"github.com/siddontang/goredis"
) )
func checkTestSortRes(ay interface{}, checks []string) error { func checkTestSortRes(ay interface{}, checks []string) error {

View File

@ -2,9 +2,10 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/goredis"
"testing" "testing"
"time" "time"
"github.com/siddontang/goredis"
) )
func now() int64 { func now() int64 {

View File

@ -2,13 +2,14 @@ package server
import ( import (
"errors" "errors"
"math"
"strconv"
"strings"
"github.com/siddontang/go/hack" "github.com/siddontang/go/hack"
"github.com/siddontang/go/num" "github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/ledis"
"github.com/siddontang/ledisdb/store" "github.com/siddontang/ledisdb/store"
"math"
"strconv"
"strings"
) )
//for simple implementation, we only support int64 score //for simple implementation, we only support int64 score

View File

@ -2,10 +2,11 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/goredis"
"reflect" "reflect"
"strconv" "strconv"
"testing" "testing"
"github.com/siddontang/goredis"
) )
func TestZSet(t *testing.T) { func TestZSet(t *testing.T) {

View File

@ -2,6 +2,7 @@ package server
import ( import (
"errors" "errors"
"github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/ledis"
) )

View File

@ -3,13 +3,14 @@ package server
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/siddontang/go/sync2"
"os" "os"
"runtime" "runtime"
"runtime/debug" "runtime/debug"
"strings" "strings"
"sync" "sync"
"time" "time"
"github.com/siddontang/go/sync2"
) )
type info struct { type info struct {

View File

@ -4,18 +4,19 @@ import (
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
"github.com/siddontang/go/log"
"github.com/siddontang/go/num"
"github.com/siddontang/go/sync2"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/ledis"
"github.com/siddontang/ledisdb/rpl"
"net" "net"
"os" "os"
"path" "path"
"strings" "strings"
"sync" "sync"
"time" "time"
"github.com/siddontang/go/log"
"github.com/siddontang/go/num"
"github.com/siddontang/go/sync2"
"github.com/siddontang/goredis"
"github.com/siddontang/ledisdb/ledis"
"github.com/siddontang/ledisdb/rpl"
) )
var ( var (

View File

@ -5,12 +5,13 @@ package server
import ( import (
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"io"
"sync"
"github.com/siddontang/go/hack" "github.com/siddontang/go/hack"
"github.com/siddontang/go/num" "github.com/siddontang/go/num"
"github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/ledis"
"github.com/siddontang/ledisdb/vendor/lua" "github.com/siddontang/ledisdb/vendor/lua"
"io"
"sync"
) )
//ledis <-> lua type conversion, same as http://redis.io/commands/eval //ledis <-> lua type conversion, same as http://redis.io/commands/eval

View File

@ -4,6 +4,7 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/vendor/lua" "github.com/siddontang/ledisdb/vendor/lua"

View File

@ -2,8 +2,6 @@ package server
import ( import (
"fmt" "fmt"
"github.com/siddontang/go/log"
"github.com/siddontang/ledisdb/config"
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
@ -11,6 +9,9 @@ import (
"sort" "sort"
"sync" "sync"
"time" "time"
"github.com/siddontang/go/log"
"github.com/siddontang/ledisdb/config"
) )
const ( const (

View File

@ -1,12 +1,13 @@
package server package server
import ( import (
"github.com/siddontang/ledisdb/config"
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"path" "path"
"testing" "testing"
"github.com/siddontang/ledisdb/config"
) )
type testSnapshotDumper struct { type testSnapshotDumper struct {

View File

@ -1,7 +1,5 @@
package server package server
import ()
func lowerSlice(buf []byte) []byte { func lowerSlice(buf []byte) []byte {
for i, r := range buf { for i, r := range buf {
if 'A' <= r && r <= 'Z' { if 'A' <= r && r <= 'Z' {

View File

@ -1,11 +1,12 @@
package boltdb package boltdb
import ( import (
"os"
"path"
"github.com/boltdb/bolt" "github.com/boltdb/bolt"
"github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver" "github.com/siddontang/ledisdb/store/driver"
"os"
"path"
) )
var bucketName = []byte("ledisdb") var bucketName = []byte("ledisdb")

View File

@ -1,10 +1,11 @@
package store package store
import ( import (
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver"
"sync" "sync"
"time" "time"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver"
) )
type DB struct { type DB struct {

View File

@ -2,6 +2,7 @@ package driver
import ( import (
"fmt" "fmt"
"github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/config"
) )

View File

@ -2,6 +2,7 @@ package store
import ( import (
"bytes" "bytes"
"github.com/siddontang/ledisdb/store/driver" "github.com/siddontang/ledisdb/store/driver"
) )

View File

@ -8,8 +8,9 @@ package leveldb
import "C" import "C"
import ( import (
"github.com/syndtr/goleveldb/leveldb"
"unsafe" "unsafe"
"github.com/syndtr/goleveldb/leveldb"
) )
type WriteBatch struct { type WriteBatch struct {

View File

@ -11,11 +11,12 @@ package leveldb
import "C" import "C"
import ( import (
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver"
"os" "os"
"runtime" "runtime"
"unsafe" "unsafe"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver"
) )
const defaultFilterBits int = 10 const defaultFilterBits int = 10

View File

@ -3,10 +3,11 @@
package mdb package mdb
import ( import (
"os"
"github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver" "github.com/siddontang/ledisdb/store/driver"
mdb "github.com/siddontang/ledisdb/vendor/gomdb" mdb "github.com/siddontang/ledisdb/vendor/gomdb"
"os"
) )
type Store struct { type Store struct {

View File

@ -12,11 +12,12 @@ package rocksdb
import "C" import "C"
import ( import (
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver"
"os" "os"
"runtime" "runtime"
"unsafe" "unsafe"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver"
) )
const defaultFilterBits int = 10 const defaultFilterBits int = 10

View File

@ -2,11 +2,12 @@ package store
import ( import (
"fmt" "fmt"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver"
"os" "os"
"path" "path"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver"
_ "github.com/siddontang/ledisdb/store/boltdb" _ "github.com/siddontang/ledisdb/store/boltdb"
_ "github.com/siddontang/ledisdb/store/goleveldb" _ "github.com/siddontang/ledisdb/store/goleveldb"
_ "github.com/siddontang/ledisdb/store/leveldb" _ "github.com/siddontang/ledisdb/store/leveldb"

View File

@ -3,11 +3,12 @@ package store
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver"
"os" "os"
"reflect" "reflect"
"testing" "testing"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store/driver"
) )
func TestStore(t *testing.T) { func TestStore(t *testing.T) {

View File

@ -1,8 +1,9 @@
package store package store
import ( import (
"github.com/siddontang/ledisdb/store/driver"
"testing" "testing"
"github.com/siddontang/ledisdb/store/driver"
) )
func TestTx(t *testing.T) { func TestTx(t *testing.T) {

View File

@ -2,9 +2,10 @@ package store
import ( import (
"encoding/binary" "encoding/binary"
"time"
"github.com/siddontang/ledisdb/store/driver" "github.com/siddontang/ledisdb/store/driver"
"github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb"
"time"
) )
type WriteBatch struct { type WriteBatch struct {

View File

@ -4,6 +4,7 @@ import (
"encoding/binary" "encoding/binary"
"flag" "flag"
"fmt" "fmt"
"github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/ledis"
"github.com/siddontang/ledisdb/store" "github.com/siddontang/ledisdb/store"