mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-05 03:27:42 +01:00
read from meta cache
meta cache is not initialized
This commit is contained in:
1 parent
b8e4238ad2
commit
4f02f7121d
5 files changed
+101
-9
No files matched your search
@@ -0,0 +1,34 @@
|
||||
package meta_cache
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2/leveldb"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
)
|
||||
|
||||
type MetaCache struct {
|
||||
filer2.FilerStore
|
||||
}
|
||||
|
||||
func NewMetaCache(dbFolder string) *MetaCache {
|
||||
return &MetaCache{
|
||||
FilerStore: OpenMetaStore(dbFolder),
|
||||
}
|
||||
}
|
||||
|
||||
func OpenMetaStore(dbFolder string) filer2.FilerStore {
|
||||
|
||||
os.MkdirAll(dbFolder, 0755)
|
||||
|
||||
store := &leveldb.LevelDBStore{}
|
||||
config := &cacheConfig{}
|
||||
|
||||
if err := store.Initialize(config, ""); err != nil {
|
||||
glog.Fatalf("Failed to initialize metadata cache store for %s: %+v", store.GetName(), err)
|
||||
}
|
||||
|
||||
return store
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user