Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

mount: avoid the need to specify different cache directory for different mount

Chris Lu62ebb917e016
diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go
index a95ecd5674..23f224cc2d 100644
--- a/weed/command/mount_std.go
+++ b/weed/command/mount_std.go
@@ -169,6 +169,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
}
seaweedFileSystem := filesys.NewSeaweedFileSystem(&filesys.Option{
+ MountDirectory: dir,
FilerAddress: filer,
FilerGrpcAddress: filerGrpcAddress,
GrpcDialOption: grpcDialOption,
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 236ecdacb3..6cfadcc18d 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -26,6 +26,7 @@ import (
)
type Option struct {
+ MountDirectory string
FilerAddress string
FilerGrpcAddress string
GrpcDialOption grpc.DialOption
@@ -92,7 +93,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
},
signature: util.RandomInt32(),
}
- cacheUniqueId := util.Md5String([]byte(option.FilerGrpcAddress + option.FilerMountRootPath + util.Version()))[0:4]
+ cacheUniqueId := util.Md5String([]byte(option.MountDirectory + option.FilerGrpcAddress + option.FilerMountRootPath + util.Version()))[0:8]
cacheDir := path.Join(option.CacheDir, cacheUniqueId)
if option.CacheSizeMB > 0 {
os.MkdirAll(cacheDir, os.FileMode(0777)&^option.Umask)