From cdbb351ab88c68ec2332a29873fb7a783d017157 Mon Sep 17 00:00:00 2001 From: siddontang Date: Mon, 4 Aug 2014 08:48:06 +0800 Subject: [PATCH] use szferi gomdb --- bootstrap.sh | 2 +- store/mdb/mdb.go | 20 ++++++++++---------- store/mdb/tx.go | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 6772133..6440466 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -8,6 +8,6 @@ go get github.com/siddontang/copier go get github.com/siddontang/goleveldb/leveldb -go get -d github.com/siddontang/gomdb +go get github.com/szferi/gomdb go get github.com/boltdb/bolt \ No newline at end of file diff --git a/store/mdb/mdb.go b/store/mdb/mdb.go index 88c4856..5d3de57 100644 --- a/store/mdb/mdb.go +++ b/store/mdb/mdb.go @@ -1,8 +1,8 @@ package mdb import ( - mdb "github.com/siddontang/gomdb" "github.com/siddontang/ledisdb/store/driver" + mdb "github.com/szferi/gomdb" "os" ) @@ -20,7 +20,7 @@ type MDB struct { func Open(c *Config) (MDB, error) { path := c.Path if c.MapSize == 0 { - c.MapSize = 1024 * 1024 * 1024 + c.MapSize = 500 * 1024 * 1024 } env, err := mdb.NewEnv() @@ -90,7 +90,7 @@ func (db MDB) BatchPut(writes []driver.Write) error { for _, w := range writes { if w.Value == nil { - itr.key, itr.value, itr.err = itr.c.Get(w.Key, mdb.SET) + itr.key, itr.value, itr.err = itr.c.Get(w.Key, nil, mdb.SET) if itr.err == nil { itr.err = itr.c.Del(0) } @@ -125,7 +125,7 @@ func (db MDB) Delete(key []byte) error { itr := db.iterator(false) defer itr.Close() - itr.key, itr.value, itr.err = itr.c.Get(key, mdb.SET) + itr.key, itr.value, itr.err = itr.c.Get(key, nil, mdb.SET) if itr.err == nil { itr.err = itr.c.Del(0) } @@ -161,31 +161,31 @@ func (itr *MDBIterator) Error() error { } func (itr *MDBIterator) getCurrent() { - itr.key, itr.value, itr.err = itr.c.Get(nil, mdb.GET_CURRENT) + itr.key, itr.value, itr.err = itr.c.Get(nil, nil, mdb.GET_CURRENT) itr.setState() } func (itr *MDBIterator) Seek(key []byte) { - itr.key, itr.value, itr.err = itr.c.Get(key, mdb.SET_RANGE) + itr.key, itr.value, itr.err = itr.c.Get(key, nil, mdb.SET_RANGE) itr.setState() } func (itr *MDBIterator) Next() { - itr.key, itr.value, itr.err = itr.c.Get(nil, mdb.NEXT) + itr.key, itr.value, itr.err = itr.c.Get(nil, nil, mdb.NEXT) itr.setState() } func (itr *MDBIterator) Prev() { - itr.key, itr.value, itr.err = itr.c.Get(nil, mdb.PREV) + itr.key, itr.value, itr.err = itr.c.Get(nil, nil, mdb.PREV) itr.setState() } func (itr *MDBIterator) First() { - itr.key, itr.value, itr.err = itr.c.Get(nil, mdb.FIRST) + itr.key, itr.value, itr.err = itr.c.Get(nil, nil, mdb.FIRST) itr.setState() } func (itr *MDBIterator) Last() { - itr.key, itr.value, itr.err = itr.c.Get(nil, mdb.LAST) + itr.key, itr.value, itr.err = itr.c.Get(nil, nil, mdb.LAST) itr.setState() } diff --git a/store/mdb/tx.go b/store/mdb/tx.go index b78f488..0946727 100644 --- a/store/mdb/tx.go +++ b/store/mdb/tx.go @@ -1,8 +1,8 @@ package mdb import ( - mdb "github.com/siddontang/gomdb" "github.com/siddontang/ledisdb/store/driver" + mdb "github.com/szferi/gomdb" ) type Tx struct { @@ -53,7 +53,7 @@ func (t *Tx) BatchPut(writes []driver.Write) error { for _, w := range writes { if w.Value == nil { - itr.key, itr.value, itr.err = itr.c.Get(w.Key, mdb.SET) + itr.key, itr.value, itr.err = itr.c.Get(w.Key, nil, mdb.SET) if itr.err == nil { itr.err = itr.c.Del(0) }