aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-01-28 15:23:16 -0800
committerChris Lu <chris.lu@gmail.com>2021-01-28 15:23:16 -0800
commit19295600f94fd18d09323cb17e89c115c811fb52 (patch)
tree0192ac117341456c3dce6d5ba915c8a5e5e0fbb7
parent990fa69bfeac65a72bec1539993e32633858c8f5 (diff)
downloadseaweedfs-19295600f94fd18d09323cb17e89c115c811fb52.tar.xz
seaweedfs-19295600f94fd18d09323cb17e89c115c811fb52.zip
mount: change option name to volumeServerAccess, with publicUrl and filerProxy modes
-rw-r--r--weed/command/mount.go28
-rw-r--r--weed/command/mount_std.go26
-rw-r--r--weed/filesys/wfs.go8
-rw-r--r--weed/filesys/wfs_filer_client.go2
-rw-r--r--weed/filesys/wfs_write.go2
5 files changed, 33 insertions, 33 deletions
diff --git a/weed/command/mount.go b/weed/command/mount.go
index fa75919aa..febc80683 100644
--- a/weed/command/mount.go
+++ b/weed/command/mount.go
@@ -11,19 +11,19 @@ type MountOptions struct {
dir *string
dirAutoCreate *bool
collection *string
- replication *string
- ttlSec *int
- chunkSizeLimitMB *int
- concurrentWriters *int
- cacheDir *string
- cacheSizeMB *int64
- dataCenter *string
- allowOthers *bool
- umaskString *string
- nonempty *bool
- outsideContainerClusterMode *bool
- uidMap *string
- gidMap *string
+ replication *string
+ ttlSec *int
+ chunkSizeLimitMB *int
+ concurrentWriters *int
+ cacheDir *string
+ cacheSizeMB *int64
+ dataCenter *string
+ allowOthers *bool
+ umaskString *string
+ nonempty *bool
+ volumeServerAccess *string
+ uidMap *string
+ gidMap *string
}
var (
@@ -50,7 +50,7 @@ func init() {
mountOptions.allowOthers = cmdMount.Flag.Bool("allowOthers", true, "allows other users to access the file system")
mountOptions.umaskString = cmdMount.Flag.String("umask", "022", "octal umask, e.g., 022, 0111")
mountOptions.nonempty = cmdMount.Flag.Bool("nonempty", false, "allows the mounting over a non-empty directory")
- mountOptions.outsideContainerClusterMode = cmdMount.Flag.Bool("outsideContainerClusterMode", false, "allows other users to access volume servers with publicUrl")
+ mountOptions.volumeServerAccess = cmdMount.Flag.String("volumeServerAccess", "direct", "access volume servers by [direct|publicUrl|filerProxy]")
mountOptions.uidMap = cmdMount.Flag.String("map.uid", "", "map local uid to uid on filer, comma-separated <local_uid>:<filer_uid>")
mountOptions.gidMap = cmdMount.Flag.String("map.gid", "", "map local gid to gid on filer, comma-separated <local_gid>:<filer_gid>")
diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go
index 8c6072255..26c59a1c7 100644
--- a/weed/command/mount_std.go
+++ b/weed/command/mount_std.go
@@ -179,19 +179,19 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
TtlSec: int32(*option.ttlSec),
ChunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024,
ConcurrentWriters: *option.concurrentWriters,
- CacheDir: *option.cacheDir,
- CacheSizeMB: *option.cacheSizeMB,
- DataCenter: *option.dataCenter,
- EntryCacheTtl: 3 * time.Second,
- MountUid: uid,
- MountGid: gid,
- MountMode: mountMode,
- MountCtime: fileInfo.ModTime(),
- MountMtime: time.Now(),
- Umask: umask,
- OutsideContainerClusterMode: *mountOptions.outsideContainerClusterMode,
- Cipher: cipher,
- UidGidMapper: uidGidMapper,
+ CacheDir: *option.cacheDir,
+ CacheSizeMB: *option.cacheSizeMB,
+ DataCenter: *option.dataCenter,
+ EntryCacheTtl: 3 * time.Second,
+ MountUid: uid,
+ MountGid: gid,
+ MountMode: mountMode,
+ MountCtime: fileInfo.ModTime(),
+ MountMtime: time.Now(),
+ Umask: umask,
+ VolumeServerAccess: *mountOptions.volumeServerAccess,
+ Cipher: cipher,
+ UidGidMapper: uidGidMapper,
})
// mount
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 108e23c85..f4e5ac38a 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -48,9 +48,9 @@ type Option struct {
MountCtime time.Time
MountMtime time.Time
- OutsideContainerClusterMode bool // whether the mount runs outside SeaweedFS containers
- Cipher bool // whether encrypt data on volume server
- UidGidMapper *meta_cache.UidGidMapper
+ VolumeServerAccess string // how to access volume servers
+ Cipher bool // whether encrypt data on volume server
+ UidGidMapper *meta_cache.UidGidMapper
}
var _ = fs.FS(&WFS{})
@@ -257,7 +257,7 @@ func (wfs *WFS) mapPbIdFromLocalToFiler(entry *filer_pb.Entry) {
}
func (wfs *WFS) LookupFn() wdclient.LookupFileIdFunctionType {
- if wfs.option.OutsideContainerClusterMode {
+ if wfs.option.VolumeServerAccess == "filerProxy" {
return func(fileId string) (targetUrls []string, err error) {
return []string{"http://" + wfs.option.FilerAddress + "/?proxyChunkId=" + fileId}, nil
}
diff --git a/weed/filesys/wfs_filer_client.go b/weed/filesys/wfs_filer_client.go
index ef4213af1..671d20ba2 100644
--- a/weed/filesys/wfs_filer_client.go
+++ b/weed/filesys/wfs_filer_client.go
@@ -27,7 +27,7 @@ func (wfs *WFS) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) erro
}
func (wfs *WFS) AdjustedUrl(location *filer_pb.Location) string {
- if wfs.option.OutsideContainerClusterMode {
+ if wfs.option.VolumeServerAccess == "publicUrl" {
return location.PublicUrl
}
return location.Url
diff --git a/weed/filesys/wfs_write.go b/weed/filesys/wfs_write.go
index 54e114013..4e1e71672 100644
--- a/weed/filesys/wfs_write.go
+++ b/weed/filesys/wfs_write.go
@@ -53,7 +53,7 @@ func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath) filer.SaveDataAsChunkFun
}
fileUrl := fmt.Sprintf("http://%s/%s", host, fileId)
- if wfs.option.OutsideContainerClusterMode {
+ if wfs.option.VolumeServerAccess == "filerProxy" {
fileUrl = fmt.Sprintf("http://%s/?proxyChunkId=%s", wfs.option.FilerAddress, fileId)
}
uploadResult, err, data := operation.Upload(fileUrl, filename, wfs.option.Cipher, reader, false, "", nil, auth)