option to filer.copy with public volume server url

fix https://github.com/seaweedfs/seaweedfs/issues/5126
This commit is contained in:
chrislu 2023-12-22 11:32:43 -08:00
parent 7a0d1e7fc1
commit 6df44d3c95

View file

@ -46,6 +46,7 @@ type CopyOptions struct {
ttlSec int32 ttlSec int32
checkSize *bool checkSize *bool
verbose *bool verbose *bool
volumeServerAccess *string
} }
func init() { func init() {
@ -61,6 +62,7 @@ func init() {
copy.concurrentChunks = cmdFilerCopy.Flag.Int("concurrentChunks", 8, "concurrent chunk copy goroutines for each file") copy.concurrentChunks = cmdFilerCopy.Flag.Int("concurrentChunks", 8, "concurrent chunk copy goroutines for each file")
copy.checkSize = cmdFilerCopy.Flag.Bool("check.size", false, "copy when the target file size is different from the source file") copy.checkSize = cmdFilerCopy.Flag.Bool("check.size", false, "copy when the target file size is different from the source file")
copy.verbose = cmdFilerCopy.Flag.Bool("verbose", false, "print out details during copying") copy.verbose = cmdFilerCopy.Flag.Bool("verbose", false, "print out details during copying")
copy.volumeServerAccess = cmdMount.Flag.String("volumeServerAccess", "direct", "access volume servers by [direct|publicUrl|filerProxy]")
} }
var cmdFilerCopy = &Command{ var cmdFilerCopy = &Command{
@ -580,6 +582,9 @@ func (worker *FileCopyWorker) WithFilerClient(streamingMode bool, fn func(filer_
} }
func (worker *FileCopyWorker) AdjustedUrl(location *filer_pb.Location) string { func (worker *FileCopyWorker) AdjustedUrl(location *filer_pb.Location) string {
if *worker.options.volumeServerAccess == "publicUrl" {
return location.PublicUrl
}
return location.Url return location.Url
} }