aboutsummaryrefslogtreecommitdiff
path: root/weed/mount/weedfs.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-02-14 01:09:31 -0800
committerchrislu <chris.lu@gmail.com>2022-02-14 01:09:31 -0800
commitdbeeda812376eda39997cd814c3e7eefaf4ea686 (patch)
tree18e989645dec87c977d59ea0fdaea8b073244b17 /weed/mount/weedfs.go
parent7286e525ad85dec877d506908a0ff35590b0f357 (diff)
downloadseaweedfs-dbeeda812376eda39997cd814c3e7eefaf4ea686.tar.xz
seaweedfs-dbeeda812376eda39997cd814c3e7eefaf4ea686.zip
listen for metadata updates
Diffstat (limited to 'weed/mount/weedfs.go')
-rw-r--r--weed/mount/weedfs.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/weed/mount/weedfs.go b/weed/mount/weedfs.go
index b7f50cd13..0fdd9bd28 100644
--- a/weed/mount/weedfs.go
+++ b/weed/mount/weedfs.go
@@ -3,7 +3,7 @@ package mount
import (
"context"
"github.com/chrislusf/seaweedfs/weed/filer"
- "github.com/chrislusf/seaweedfs/weed/filesys/meta_cache"
+ "github.com/chrislusf/seaweedfs/weed/mount/meta_cache"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/storage/types"
@@ -91,7 +91,11 @@ func NewSeaweedFileSystem(option *Option) *WFS {
wfs.chunkCache = chunk_cache.NewTieredChunkCache(256, option.getUniqueCacheDir(), option.CacheSizeMB, 1024*1024)
}
- wfs.metaCache = meta_cache.NewMetaCache(path.Join(option.getUniqueCacheDir(), "meta"), util.FullPath(option.FilerMountRootPath), option.UidGidMapper, func(filePath util.FullPath, entry *filer_pb.Entry) {
+ wfs.metaCache = meta_cache.NewMetaCache(path.Join(option.getUniqueCacheDir(), "meta"), option.UidGidMapper, func(path util.FullPath) {
+ wfs.inodeToPath.MarkChildrenCached(path)
+ }, func(path util.FullPath) bool {
+ return wfs.inodeToPath.IsChildrenCached(path)
+ }, func(filePath util.FullPath, entry *filer_pb.Entry) {
})
grace.OnInterrupt(func() {
wfs.metaCache.Shutdown()
@@ -103,6 +107,11 @@ func NewSeaweedFileSystem(option *Option) *WFS {
return wfs
}
+func (wfs *WFS) StartBackgroundTasks() {
+ startTime := time.Now()
+ go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs.signature, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano())
+}
+
func (wfs *WFS) Root() *Directory {
return &wfs.root
}