diff options
| author | chrislu <chris.lu@gmail.com> | 2022-01-11 23:44:48 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-01-11 23:44:48 -0800 |
| commit | 2dcb8cb93b951bd8457cdb670edf2146b068a836 (patch) | |
| tree | dfbe0e451b3c0f32204cd52e8ea3a617a8ca201f /weed/filesys/meta_cache | |
| parent | 5bb37d5905bbc2b091540ff96e0b1389e1016029 (diff) | |
| download | seaweedfs-2dcb8cb93b951bd8457cdb670edf2146b068a836.tar.xz seaweedfs-2dcb8cb93b951bd8457cdb670edf2146b068a836.zip | |
POSIX: ensure file and directory inodes are different
this is just an in memory representation.
POSIX wants different inode numbers for the same named file or directory.
Diffstat (limited to 'weed/filesys/meta_cache')
| -rw-r--r-- | weed/filesys/meta_cache/meta_cache.go | 8 | ||||
| -rw-r--r-- | weed/filesys/meta_cache/meta_cache_subscribe.go | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/weed/filesys/meta_cache/meta_cache.go b/weed/filesys/meta_cache/meta_cache.go index 6d5eeca03..adb3f144f 100644 --- a/weed/filesys/meta_cache/meta_cache.go +++ b/weed/filesys/meta_cache/meta_cache.go @@ -18,16 +18,16 @@ type MetaCache struct { // sync.RWMutex visitedBoundary *bounded_tree.BoundedTree uidGidMapper *UidGidMapper - invalidateFunc func(util.FullPath) + invalidateFunc func(fullpath util.FullPath, isDirectory bool) } -func NewMetaCache(dbFolder string, baseDir util.FullPath, uidGidMapper *UidGidMapper, invalidateFunc func(util.FullPath)) *MetaCache { +func NewMetaCache(dbFolder string, baseDir util.FullPath, uidGidMapper *UidGidMapper, invalidateFunc func(util.FullPath, bool)) *MetaCache { return &MetaCache{ localStore: openMetaStore(dbFolder), visitedBoundary: bounded_tree.NewBoundedTree(baseDir), uidGidMapper: uidGidMapper, - invalidateFunc: func(fullpath util.FullPath) { - invalidateFunc(fullpath) + invalidateFunc: func(fullpath util.FullPath, isDirectory bool) { + invalidateFunc(fullpath, isDirectory) }, } } diff --git a/weed/filesys/meta_cache/meta_cache_subscribe.go b/weed/filesys/meta_cache/meta_cache_subscribe.go index 64a8b76b9..f33461dd4 100644 --- a/weed/filesys/meta_cache/meta_cache_subscribe.go +++ b/weed/filesys/meta_cache/meta_cache_subscribe.go @@ -40,16 +40,16 @@ func SubscribeMetaEvents(mc *MetaCache, selfSignature int32, client filer_pb.Fil if err == nil { if message.OldEntry != nil && message.NewEntry != nil { oldKey := util.NewFullPath(resp.Directory, message.OldEntry.Name) - mc.invalidateFunc(oldKey) + mc.invalidateFunc(oldKey, message.OldEntry.IsDirectory) if message.OldEntry.Name != message.NewEntry.Name { newKey := util.NewFullPath(dir, message.NewEntry.Name) - mc.invalidateFunc(newKey) + mc.invalidateFunc(newKey, message.NewEntry.IsDirectory) } } else if message.OldEntry == nil && message.NewEntry != nil { // no need to invaalidate } else if message.OldEntry != nil && message.NewEntry == nil { oldKey := util.NewFullPath(resp.Directory, message.OldEntry.Name) - mc.invalidateFunc(oldKey) + mc.invalidateFunc(oldKey, message.OldEntry.IsDirectory) } } |
