async meta caching: can stream updates now

This commit is contained in:
Chris Lu
2020-04-21 21:16:13 -07:00
parent 4f02f7121d
commit e24b25de78
10 changed files with 236 additions and 127 deletions

View File

@@ -95,6 +95,14 @@ func NewSeaweedFileSystem(option *Option) *WFS {
}
if wfs.option.AsyncMetaDataCaching {
wfs.metaCache = meta_cache.NewMetaCache(path.Join(option.CacheDir, "meta"))
if err := meta_cache.InitMetaCache(wfs.metaCache, wfs); err != nil{
glog.V(0).Infof("failed to init meta cache: %v", err)
} else {
go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs, wfs.option.FilerMountRootPath)
util.OnInterrupt(func() {
wfs.metaCache.Shutdown()
})
}
}
wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs}