diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-04-18 20:21:28 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-04-18 20:21:28 -0700 |
| commit | a2d34d4802978b294d536966aa98bec34058eea9 (patch) | |
| tree | c525510fe5064cbea0a89c58e867f612ba5fc226 /weed/command/filer_copy.go | |
| parent | 072644969e276d6071bed13cbf95320d25b8d468 (diff) | |
| download | seaweedfs-a2d34d4802978b294d536966aa98bec34058eea9.tar.xz seaweedfs-a2d34d4802978b294d536966aa98bec34058eea9.zip | |
filer.copy: add adjustable compression level
Diffstat (limited to 'weed/command/filer_copy.go')
| -rw-r--r-- | weed/command/filer_copy.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go index 777e52ab6..c18b9f055 100644 --- a/weed/command/filer_copy.go +++ b/weed/command/filer_copy.go @@ -29,16 +29,17 @@ var ( ) type CopyOptions struct { - filerGrpcPort *int - master *string - include *string - replication *string - collection *string - ttl *string - maxMB *int - grpcDialOption grpc.DialOption - masterClient *wdclient.MasterClient - concurrency *int + filerGrpcPort *int + master *string + include *string + replication *string + collection *string + ttl *string + maxMB *int + grpcDialOption grpc.DialOption + masterClient *wdclient.MasterClient + concurrency *int + compressionLevel *int } func init() { @@ -52,6 +53,7 @@ func init() { copy.maxMB = cmdCopy.Flag.Int("maxMB", 32, "split files larger than the limit") copy.filerGrpcPort = cmdCopy.Flag.Int("filer.port.grpc", 0, "filer grpc server listen port, default to filer port + 10000") copy.concurrency = cmdCopy.Flag.Int("c", 8, "concurrent file copy goroutines") + copy.compressionLevel = cmdCopy.Flag.Int("compressionLevel", 9, "local file compression level 1 ~ 9") } var cmdCopy = &Command{ @@ -265,7 +267,7 @@ func (worker *FileCopyWorker) uploadFileAsOne(ctx context.Context, task FileCopy targetUrl := "http://" + assignResult.Url + "/" + assignResult.Fid - uploadResult, err := operation.Upload(targetUrl, fileName, f, false, mimeType, nil, assignResult.Auth) + uploadResult, err := operation.UploadWithLocalCompressionLevel(targetUrl, fileName, f, false, mimeType, nil, assignResult.Auth, *worker.options.compressionLevel) if err != nil { return fmt.Errorf("upload data %v to %s: %v\n", fileName, targetUrl, err) } |
