aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/wfs.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-09-03 00:07:22 -0700
committerChris Lu <chris.lu@gmail.com>2020-09-03 00:07:22 -0700
commit7e1aad0b54bd3d6d1bc2bd8940aeeaf7186bcfa4 (patch)
tree6aabe62fc9fd7d02ee92037386bb54de63910080 /weed/filesys/wfs.go
parent68e878adb5d63cb961fdff8585bd6eede3b616f1 (diff)
downloadseaweedfs-7e1aad0b54bd3d6d1bc2bd8940aeeaf7186bcfa4.tar.xz
seaweedfs-7e1aad0b54bd3d6d1bc2bd8940aeeaf7186bcfa4.zip
mount: map uid/gid between local and filer
Diffstat (limited to 'weed/filesys/wfs.go')
-rw-r--r--weed/filesys/wfs.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 93819dfa4..8d46e0862 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -45,7 +45,7 @@ type Option struct {
OutsideContainerClusterMode bool // whether the mount runs outside SeaweedFS containers
Cipher bool // whether encrypt data on volume server
-
+ UidGidMapper *meta_cache.UidGidMapper
}
var _ = fs.FS(&WFS{})
@@ -92,7 +92,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
wfs.chunkCache = chunk_cache.NewTieredChunkCache(256, cacheDir, option.CacheSizeMB)
}
- wfs.metaCache = meta_cache.NewMetaCache(path.Join(cacheDir, "meta"))
+ wfs.metaCache = meta_cache.NewMetaCache(path.Join(cacheDir, "meta"), option.UidGidMapper)
startTime := time.Now()
go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs.signature, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano())
grace.OnInterrupt(func() {
@@ -206,3 +206,10 @@ func (wfs *WFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.
return nil
}
+
+func (wfs *WFS) mapPbIdFromFilerToLocal(entry *filer_pb.Entry) {
+ entry.Attributes.Uid, entry.Attributes.Gid = wfs.option.UidGidMapper.FilerToLocal(entry.Attributes.Uid, entry.Attributes.Gid)
+}
+func (wfs *WFS) mapPbIdFromLocalToFiler(entry *filer_pb.Entry) {
+ entry.Attributes.Uid, entry.Attributes.Gid = wfs.option.UidGidMapper.LocalToFiler(entry.Attributes.Uid, entry.Attributes.Gid)
+}