serve s3: pre-merge tweaks

- Changes
    - Rename `--s3-authkey` to `--auth-key` to get it out of the s3 backend namespace
    - Enable `Content-MD5` integrity checks
    - Remove locking after code audit
- Documentation
    - Factor out documentation into seperate file
    - Add Quickstart to docs
    - Add Bugs section to docs
    - Add experimental tag to docs
    - Add rclone provider to s3 backend docs
- Fixes
    - Correct quirks in s3 backend
    - Change fmt.Printlns into fs.Logs
    - Make metadata storage per backend not global
    - Log on startup if anonymous access is enabled
- Coding style fixes
    - rename fs to vfs to save confusion with the rest of rclone code
    - rename db to b for *s3Backend

Fixes #7062
This commit is contained in:
Nick Craig-Wood
2023-11-13 16:40:34 +00:00
parent a2c4f07a57
commit 93f35c915a
11 changed files with 831 additions and 172 deletions

View File

@@ -2,7 +2,7 @@ package s3
import (
"context"
"strings"
_ "embed"
"github.com/rclone/rclone/cmd"
"github.com/rclone/rclone/fs/config/flags"
@@ -33,15 +33,23 @@ func init() {
vfsflags.AddFlags(flagSet)
flags.BoolVarP(flagSet, &Opt.pathBucketMode, "force-path-style", "", Opt.pathBucketMode, "If true use path style access if false use virtual hosted style (default true)", "")
flags.StringVarP(flagSet, &Opt.hashName, "etag-hash", "", Opt.hashName, "Which hash to use for the ETag, or auto or blank for off", "")
flags.StringArrayVarP(flagSet, &Opt.authPair, "s3-authkey", "", Opt.authPair, "Set key pair for v4 authorization, split by comma", "")
flags.StringArrayVarP(flagSet, &Opt.authPair, "auth-key", "", Opt.authPair, "Set key pair for v4 authorization: access_key_id,secret_access_key", "")
flags.BoolVarP(flagSet, &Opt.noCleanup, "no-cleanup", "", Opt.noCleanup, "Not to cleanup empty folder after object is deleted", "")
}
//go:embed serve_s3.md
var serveS3Help string
// Command definition for cobra
var Command = &cobra.Command{
Annotations: map[string]string{
"versionIntroduced": "v1.65",
"groups": "Filter",
"status": "Experimental",
},
Use: "s3 remote:path",
Short: `Serve remote:path over s3.`,
Long: strings.ReplaceAll(longHelp, "|", "`") + httplib.Help(flagPrefix) + vfs.Help,
Long: serveS3Help + httplib.Help(flagPrefix) + vfs.Help,
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(1, 1, command, args)
f := cmd.NewFsSrc(args)