Skip to content

Commit

Permalink
rename "concurrentUploads" to "concurrentConnections"
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Urban committed Aug 18, 2024
1 parent 98feab5 commit 9e7e93e
Show file tree
Hide file tree
Showing 4 changed files with 312 additions and 311 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ WARNING: Azure support is not guaranted because there are no free solutions for
testing on it

When set to `b2`, files are uploaded to Backblaze B2. The `--b2-*` family of options can be used to tweak the access to
the bucket. `--b2-concurrent-uploads` can be used to upload the file through parallel HTTP connections.
the bucket. `--b2-concurrent-connections` can be used to upload the file through parallel HTTP connections.

The `--upload-prefix` option can be used to place the files in a remote
directory, as most cloud storage treat prefix as directories. The filename and
Expand Down
66 changes: 33 additions & 33 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ type options struct {
S3ForcePath bool
S3DisableTLS bool

B2Region string
B2Bucket string
B2Endpoint string
B2KeyID string
B2AppKey string
B2ForcePath bool
B2ConcurrentUploads int
B2Region string
B2Bucket string
B2Endpoint string
B2KeyID string
B2AppKey string
B2ForcePath bool
B2ConcurrentConnections int

SFTPHost string
SFTPPort string
Expand All @@ -129,24 +129,24 @@ func defaultOptions() options {
}

return options{
NoConfigFile: false,
Directory: "/var/backups/postgresql",
Format: 'c',
DirJobs: 1,
CompressLevel: -1,
Jobs: 1,
PauseTimeout: 3600,
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: defaultCfgFile,
TimeFormat: timeFormat,
WithRolePasswords: true,
Upload: "none",
Download: "none",
ListRemote: "none",
AzureEndpoint: "blob.core.windows.net",
B2ConcurrentUploads: 5,
NoConfigFile: false,
Directory: "/var/backups/postgresql",
Format: 'c',
DirJobs: 1,
CompressLevel: -1,
Jobs: 1,
PauseTimeout: 3600,
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: defaultCfgFile,
TimeFormat: timeFormat,
WithRolePasswords: true,
Upload: "none",
Download: "none",
ListRemote: "none",
AzureEndpoint: "blob.core.windows.net",
B2ConcurrentConnections: 5,
}
}

Expand Down Expand Up @@ -309,7 +309,7 @@ func parseCli(args []string) (options, []string, error) {
pflag.StringVar(&opts.B2KeyID, "b2-key-id", "", "B2 access key ID")
pflag.StringVar(&opts.B2AppKey, "b2-app-key", "", "B2 app key")
B2ForcePath := pflag.String("b2-force-path", "no", "force path style addressing instead of virtual hosted bucket\naddressing")
B2ConcurrentUploads := pflag.Int("b2-concurrent-uploads", 5, "set the amount of concurrent b2 http uploads")
B2ConcurrentConnections := pflag.Int("b2-concurrent-uploads", 5, "set the amount of concurrent b2 http uploads")

pflag.StringVar(&opts.S3Region, "s3-region", "", "S3 region")
pflag.StringVar(&opts.S3Bucket, "s3-bucket", "", "S3 bucket")
Expand Down Expand Up @@ -490,10 +490,10 @@ func parseCli(args []string) (options, []string, error) {
return opts, changed, fmt.Errorf("invalid value for --b2-force-path: %s", err)
}

if *B2ConcurrentUploads <= 0 {
return opts, changed, fmt.Errorf("b2 concurrent uploads must be more than 0 (current %d)", *B2ConcurrentUploads)
if *B2ConcurrentConnections <= 0 {
return opts, changed, fmt.Errorf("b2 concurrent uploads must be more than 0 (current %d)", *B2ConcurrentConnections)
} else {
opts.B2ConcurrentUploads = *B2ConcurrentUploads
opts.B2ConcurrentConnections = *B2ConcurrentConnections
}

case "s3":
Expand Down Expand Up @@ -640,7 +640,7 @@ func loadConfigurationFile(path string) (options, error) {
opts.B2KeyID = s.Key("b2_key_id").MustString("")
opts.B2AppKey = s.Key("b2_app_key").MustString("")
opts.B2ForcePath = s.Key("b2_force_path").MustBool(false)
opts.B2ConcurrentUploads = s.Key("b2_concurrent_uploads").MustInt(5)
opts.B2ConcurrentConnections = s.Key("b2_concurrent_uploads").MustInt(5)

opts.S3Region = s.Key("s3_region").MustString("")
opts.S3Bucket = s.Key("s3_bucket").MustString("")
Expand Down Expand Up @@ -700,8 +700,8 @@ func loadConfigurationFile(path string) (options, error) {
}
}

if opts.B2ConcurrentUploads <= 0 {
return opts, fmt.Errorf("b2 concurrent uploads must be more than 0 (current %d)", opts.B2ConcurrentUploads)
if opts.B2ConcurrentConnections <= 0 {
return opts, fmt.Errorf("b2 concurrent uploads must be more than 0 (current %d)", opts.B2ConcurrentConnections)
}

// Validate upload option
Expand Down Expand Up @@ -901,7 +901,7 @@ func mergeCliAndConfigOptions(cliOpts options, configOpts options, onCli []strin
case "b2-force-path":
opts.B2ForcePath = cliOpts.B2ForcePath
case "b2-concurrent-uploads":
opts.B2ConcurrentUploads = cliOpts.B2ConcurrentUploads
opts.B2ConcurrentConnections = cliOpts.B2ConcurrentConnections

case "s3-region":
opts.S3Region = cliOpts.S3Region
Expand Down
Loading

0 comments on commit 9e7e93e

Please sign in to comment.