Skip to content

Commit

Permalink
tidb: remove tidb dependencies. (pingcap#1068)
Browse files Browse the repository at this point in the history
* tidb: remove tidb dependencies.

Define multiple main packages for different storage engine, remove `tidb` dependencies.

* *: register store in tidb-server/main.go
  • Loading branch information
coocood committed Apr 8, 2016
1 parent a236ab9 commit c82fbeb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
9 changes: 8 additions & 1 deletion tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,28 @@ import (
"time"

"github.com/ngaut/log"
"github.com/pingcap/ticlient"
"github.com/pingcap/tidb"
"github.com/pingcap/tidb/metric"
"github.com/pingcap/tidb/store/hbase"
"github.com/pingcap/tidb/store/localstore/boltdb"
"github.com/pingcap/tidb/tidb-server/server"
"github.com/pingcap/tidb/util/printer"
)

var (
store = flag.String("store", "goleveldb", "registered store name, [hbase, memory, goleveldb, boltdb]")
store = flag.String("store", "goleveldb", "registered store name, [memory, goleveldb, hbase, boltdb, tikv]")
storePath = flag.String("path", "/tmp/tidb", "tidb storage path")
logLevel = flag.String("L", "debug", "log level: info, debug, warn, error, fatal")
port = flag.String("P", "4000", "mp server port")
lease = flag.Int("lease", 1, "schema lease seconds, very dangerous to change only if you know what you do")
)

func main() {
tidb.RegisterStore("hbase", hbasekv.Driver{})
tidb.RegisterLocalStore("boltdb", boltdb.Driver{})
tidb.RegisterStore("tikv", ticlient.Driver{})

metric.RunMetric(3 * time.Second)
printer.PrintTiDBInfo()
runtime.GOMAXPROCS(runtime.NumCPU())
Expand Down
17 changes: 3 additions & 14 deletions tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (

"github.com/juju/errors"
"github.com/ngaut/log"
"github.com/pingcap/ticlient"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/context"
"github.com/pingcap/tidb/domain"
Expand All @@ -38,23 +37,17 @@ import (
"github.com/pingcap/tidb/parser"
"github.com/pingcap/tidb/sessionctx/autocommit"
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/store/hbase"
"github.com/pingcap/tidb/store/localstore"
"github.com/pingcap/tidb/store/localstore/boltdb"
"github.com/pingcap/tidb/store/localstore/engine"
"github.com/pingcap/tidb/store/localstore/goleveldb"
"github.com/pingcap/tidb/util/types"
)

// Engine prefix name
const (
EngineGoLevelDBMemory = "memory://"
EngineGoLevelDBPersistent = "goleveldb://"
EngineBoltDB = "boltdb://"
EngineHBase = "hbase://"
EngineTiKV = "tikv://"
defaultMaxRetries = 30
retrySleepInterval = 500 * time.Millisecond
EngineGoLevelDBMemory = "memory://"
defaultMaxRetries = 30
retrySleepInterval = 500 * time.Millisecond
)

type domainMap struct {
Expand Down Expand Up @@ -288,10 +281,6 @@ func init() {
// Register default memory and goleveldb storage
RegisterLocalStore("memory", goleveldb.MemoryDriver{})
RegisterLocalStore("goleveldb", goleveldb.Driver{})
RegisterLocalStore("boltdb", boltdb.Driver{})
RegisterStore("hbase", hbasekv.Driver{})
RegisterStore("tikv", ticlient.Driver{})

// start pprof handlers
if EnablePprof {
go http.ListenAndServe(PprofAddr, nil)
Expand Down

0 comments on commit c82fbeb

Please sign in to comment.