提交 5debb56c 编写于 作者: X xiaojianming

1

上级 db1ba323
......@@ -42,7 +42,7 @@ type Options struct {
DataBlockSize uint32 `json:"D"`
TotalVolumn uint64 `json:"C"`
//updata to leveldb
UseLvDb bool
UseKvDb bool
}
// Equal compares 2 Options to tell if it is equal
......
......@@ -148,12 +148,13 @@ func openYTFS(dir string, config *opt.Options) (*YTFS, error) {
}
ytfs := &YTFS{
config: config,
mdb: mDB,
db: indexDB,
context: context,
mutex: new(sync.Mutex),
}
ytfs.config.UseLvDb = true //todo xiaojm
ytfs.config.UseKvDb = true
fmt.Println("Open YTFS success @" + dir)
return ytfs, nil
}
......@@ -191,7 +192,7 @@ func validateYTFSSchema(meta *ydcommon.Header, opt *opt.Options) (*ydcommon.Head
// of the returned slice.
// It is safe to modify the contents of the argument after Get returns.
func (ytfs *YTFS) Get(key ydcommon.IndexTableKey) ([]byte, error) {
if ytfs.config.UseLvDb{
if ytfs.config.UseKvDb{
return ytfs.GetL(key)
}
return ytfs.GetI(key)
......@@ -340,7 +341,7 @@ func (ytfs *YTFS)resetKV(batchIndexes []ydcommon.IndexItem,resetCnt uint32){
// It is safe to modify the contents of the arguments after Put returns but not
// before.
func (ytfs *YTFS) BatchPut(batch map[ydcommon.IndexTableKey][]byte) (map[ydcommon.IndexTableKey]byte, error) {
if ytfs.config.UseLvDb {
if ytfs.config.UseKvDb {
return ytfs.BatchPutL(batch)
}
return ytfs.BatchPutI(batch)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册