aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/dir.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-04-22 15:40:47 -0700
committerChris Lu <chris.lu@gmail.com>2020-04-22 15:40:47 -0700
commit5d0e1d8d741b93c8f77b6ff709b5079580c7dda6 (patch)
tree1353af891f287a2878c34c5c1c63ec07f136a672 /weed/filesys/dir.go
parent1a34fd0b44f5379e419aada1785e9d7e4f8fcc6b (diff)
downloadseaweedfs-5d0e1d8d741b93c8f77b6ff709b5079580c7dda6.tar.xz
seaweedfs-5d0e1d8d741b93c8f77b6ff709b5079580c7dda6.zip
also writes to local meta cache
before waiting for subscribed meta events
Diffstat (limited to 'weed/filesys/dir.go')
-rw-r--r--weed/filesys/dir.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go
index 5b0e17ea3..b91aa3a72 100644
--- a/weed/filesys/dir.go
+++ b/weed/filesys/dir.go
@@ -7,6 +7,7 @@ import (
"strings"
"time"
+ "github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/util"
@@ -137,6 +138,11 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
}
return fuse.EIO
}
+
+ if dir.wfs.option.AsyncMetaDataCaching {
+ dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
+ }
+
return nil
}); err != nil {
return nil, nil, err
@@ -184,6 +190,10 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
return err
}
+ if dir.wfs.option.AsyncMetaDataCaching {
+ dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
+ }
+
return nil
})
@@ -320,6 +330,10 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
return fuse.ENOENT
}
+ if dir.wfs.option.AsyncMetaDataCaching {
+ dir.wfs.metaCache.DeleteEntry(context.Background(), filePath)
+ }
+
return nil
}
@@ -336,6 +350,11 @@ func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error {
glog.V(3).Infof("not found remove %s/%s: %v", dir.FullPath(), req.Name, err)
return fuse.ENOENT
}
+
+ if dir.wfs.option.AsyncMetaDataCaching {
+ dir.wfs.metaCache.DeleteEntry(context.Background(), t)
+ }
+
return nil
}
@@ -458,6 +477,10 @@ func (dir *Dir) saveEntry() error {
return fuse.EIO
}
+ if dir.wfs.option.AsyncMetaDataCaching {
+ dir.wfs.metaCache.UpdateEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
+ }
+
return nil
})
}