Переглянути джерело

portable mode: add flags for s3 upload part size and concurrency

Nicola Murino 5 роки тому
батько
коміт
f4e872c782
2 змінених файлів з 15 додано та 8 видалено
  1. 13 7
      cmd/portable.go
  2. 2 1
      docs/portable-mode.md

+ 13 - 7
cmd/portable.go

@@ -37,6 +37,8 @@ var (
 	portableS3Endpoint           string
 	portableS3Endpoint           string
 	portableS3StorageClass       string
 	portableS3StorageClass       string
 	portableS3KeyPrefix          string
 	portableS3KeyPrefix          string
+	portableS3ULPartSize         int
+	portableS3ULConcurrency      int
 	portableGCSBucket            string
 	portableGCSBucket            string
 	portableGCSCredentialsFile   string
 	portableGCSCredentialsFile   string
 	portableGCSAutoCredentials   int
 	portableGCSAutoCredentials   int
@@ -101,13 +103,15 @@ Please take a look at the usage below to customize the serving parameters`,
 					FsConfig: dataprovider.Filesystem{
 					FsConfig: dataprovider.Filesystem{
 						Provider: portableFsProvider,
 						Provider: portableFsProvider,
 						S3Config: vfs.S3FsConfig{
 						S3Config: vfs.S3FsConfig{
-							Bucket:       portableS3Bucket,
-							Region:       portableS3Region,
-							AccessKey:    portableS3AccessKey,
-							AccessSecret: portableS3AccessSecret,
-							Endpoint:     portableS3Endpoint,
-							StorageClass: portableS3StorageClass,
-							KeyPrefix:    portableS3KeyPrefix,
+							Bucket:            portableS3Bucket,
+							Region:            portableS3Region,
+							AccessKey:         portableS3AccessKey,
+							AccessSecret:      portableS3AccessSecret,
+							Endpoint:          portableS3Endpoint,
+							StorageClass:      portableS3StorageClass,
+							KeyPrefix:         portableS3KeyPrefix,
+							UploadPartSize:    int64(portableS3ULPartSize),
+							UploadConcurrency: portableS3ULConcurrency,
 						},
 						},
 						GCSConfig: vfs.GCSFsConfig{
 						GCSConfig: vfs.GCSFsConfig{
 							Bucket:               portableGCSBucket,
 							Bucket:               portableGCSBucket,
@@ -160,6 +164,8 @@ func init() {
 	portableCmd.Flags().StringVar(&portableS3StorageClass, "s3-storage-class", "", "")
 	portableCmd.Flags().StringVar(&portableS3StorageClass, "s3-storage-class", "", "")
 	portableCmd.Flags().StringVar(&portableS3KeyPrefix, "s3-key-prefix", "", "Allows to restrict access to the virtual folder "+
 	portableCmd.Flags().StringVar(&portableS3KeyPrefix, "s3-key-prefix", "", "Allows to restrict access to the virtual folder "+
 		"identified by this prefix and its contents")
 		"identified by this prefix and its contents")
+	portableCmd.Flags().IntVar(&portableS3ULPartSize, "s3-upload-part-size", 5, "The buffer size for multipart uploads (MB)")
+	portableCmd.Flags().IntVar(&portableS3ULConcurrency, "s3-upload-concurrency", 2, "How many parts are uploaded in parallel")
 	portableCmd.Flags().StringVar(&portableGCSBucket, "gcs-bucket", "", "")
 	portableCmd.Flags().StringVar(&portableGCSBucket, "gcs-bucket", "", "")
 	portableCmd.Flags().StringVar(&portableGCSStorageClass, "gcs-storage-class", "", "")
 	portableCmd.Flags().StringVar(&portableGCSStorageClass, "gcs-storage-class", "", "")
 	portableCmd.Flags().StringVar(&portableGCSKeyPrefix, "gcs-key-prefix", "", "Allows to restrict access to the virtual folder "+
 	portableCmd.Flags().StringVar(&portableGCSKeyPrefix, "gcs-key-prefix", "", "Allows to restrict access to the virtual folder "+

+ 2 - 1
docs/portable-mode.md

@@ -37,10 +37,11 @@ Flags:
       --s3-key-prefix string             Allows to restrict access to the virtual folder identified by this prefix and its contents
       --s3-key-prefix string             Allows to restrict access to the virtual folder identified by this prefix and its contents
       --s3-region string
       --s3-region string
       --s3-storage-class string
       --s3-storage-class string
+      --s3-upload-concurrency int        How many parts are uploaded in parallel (default 2)
+      --s3-upload-part-size int          The buffer size for multipart uploads (MB) (default 5)
   -s, --sftpd-port int                   0 means a random non privileged port
   -s, --sftpd-port int                   0 means a random non privileged port
   -c, --ssh-commands strings             SSH commands to enable. "*" means any supported SSH command including scp (default [md5sum,sha1sum,cd,pwd])
   -c, --ssh-commands strings             SSH commands to enable. "*" means any supported SSH command including scp (default [md5sum,sha1sum,cd,pwd])
   -u, --username string                  Leave empty to use an auto generated value
   -u, --username string                  Leave empty to use an auto generated value
-
 ```
 ```
 
 
 In portable mode, SFTPGo can advertise the SFTP service and, optionally, the credentials via multicast DNS, so there is a standard way to discover the service and to automatically connect to it.
 In portable mode, SFTPGo can advertise the SFTP service and, optionally, the credentials via multicast DNS, so there is a standard way to discover the service and to automatically connect to it.