From 5debb56caad0bf03b263a9e753a564ce5f34a113 Mon Sep 17 00:00:00 2001 From: xiaojianming Date: Tue, 28 Apr 2020 17:52:56 +0800 Subject: [PATCH] 1 --- opt/options.go | 2 +- ytfs.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/opt/options.go b/opt/options.go index a5c7247..d90cad5 100644 --- a/opt/options.go +++ b/opt/options.go @@ -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 diff --git a/ytfs.go b/ytfs.go index 733520e..114cf62 100644 --- a/ytfs.go +++ b/ytfs.go @@ -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) -- GitLab