Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Fargher <jfargher@gitlab.com>2021-11-08 01:14:02 +0300
committerJames Fargher <jfargher@gitlab.com>2021-11-08 02:21:17 +0300
commit050a9c6b63da588e2f9e01300151af2dfb3b4c8e (patch)
tree4a16fdeab49fc7226fbd5d95076360fae74bdddf
parenta49570e725af9ece4f04dcb89760352af9f39b68 (diff)
gitaly-backup: Rename locator flag to layout
While writing docs for gitaly-backup it became clear that using the name `locator` did not make sense. This would be a breaking change except that the flag is part of an experimental feature. Changelog: changed
-rw-r--r--cmd/gitaly-backup/create.go6
-rw-r--r--cmd/gitaly-backup/restore.go6
-rw-r--r--doc/gitaly-backup.md6
-rw-r--r--internal/backup/backup.go6
-rw-r--r--internal/backup/backup_test.go14
5 files changed, 19 insertions, 19 deletions
diff --git a/cmd/gitaly-backup/create.go b/cmd/gitaly-backup/create.go
index 11f1942fe..6c1ef8dfa 100644
--- a/cmd/gitaly-backup/create.go
+++ b/cmd/gitaly-backup/create.go
@@ -27,7 +27,7 @@ type createSubcommand struct {
backupPath string
parallel int
parallelStorage int
- locator string
+ layout string
incremental bool
backupID string
}
@@ -36,7 +36,7 @@ func (cmd *createSubcommand) Flags(fs *flag.FlagSet) {
fs.StringVar(&cmd.backupPath, "path", "", "repository backup path")
fs.IntVar(&cmd.parallel, "parallel", runtime.NumCPU(), "maximum number of parallel backups")
fs.IntVar(&cmd.parallelStorage, "parallel-storage", 2, "maximum number of parallel backups per storage. Note: actual parallelism when combined with `-parallel` depends on the order the repositories are received.")
- fs.StringVar(&cmd.locator, "locator", "legacy", "determines how backup files are located. One of legacy, pointer. Note: The feature is not ready for production use.")
+ fs.StringVar(&cmd.layout, "layout", "legacy", "determines how backup files are located. One of legacy, pointer. Note: The feature is not ready for production use.")
fs.BoolVar(&cmd.incremental, "incremental", false, "creates an incremental backup if possible.")
fs.StringVar(&cmd.backupID, "id", time.Now().UTC().Format("20060102150405"), "the backup ID used when creating a full backup.")
}
@@ -47,7 +47,7 @@ func (cmd *createSubcommand) Run(ctx context.Context, stdin io.Reader, stdout io
return fmt.Errorf("create: resolve sink: %w", err)
}
- locator, err := backup.ResolveLocator(cmd.locator, sink)
+ locator, err := backup.ResolveLocator(cmd.layout, sink)
if err != nil {
return fmt.Errorf("create: resolve locator: %w", err)
}
diff --git a/cmd/gitaly-backup/restore.go b/cmd/gitaly-backup/restore.go
index 6e53af36f..3780aba49 100644
--- a/cmd/gitaly-backup/restore.go
+++ b/cmd/gitaly-backup/restore.go
@@ -29,14 +29,14 @@ type restoreSubcommand struct {
backupPath string
parallel int
parallelStorage int
- locator string
+ layout string
}
func (cmd *restoreSubcommand) Flags(fs *flag.FlagSet) {
fs.StringVar(&cmd.backupPath, "path", "", "repository backup path")
fs.IntVar(&cmd.parallel, "parallel", runtime.NumCPU(), "maximum number of parallel restores")
fs.IntVar(&cmd.parallelStorage, "parallel-storage", 2, "maximum number of parallel restores per storage. Note: actual parallelism when combined with `-parallel` depends on the order the repositories are received.")
- fs.StringVar(&cmd.locator, "locator", "legacy", "determines how backup files are located. One of legacy, pointer. Note: The feature is not ready for production use.")
+ fs.StringVar(&cmd.layout, "layout", "legacy", "determines how backup files are located. One of legacy, pointer. Note: The feature is not ready for production use.")
}
func (cmd *restoreSubcommand) Run(ctx context.Context, stdin io.Reader, stdout io.Writer) error {
@@ -45,7 +45,7 @@ func (cmd *restoreSubcommand) Run(ctx context.Context, stdin io.Reader, stdout i
return fmt.Errorf("restore: resolve sink: %w", err)
}
- locator, err := backup.ResolveLocator(cmd.locator, sink)
+ locator, err := backup.ResolveLocator(cmd.layout, sink)
if err != nil {
return fmt.Errorf("restore: resolve locator: %w", err)
}
diff --git a/doc/gitaly-backup.md b/doc/gitaly-backup.md
index 177643be9..cf2f1651c 100644
--- a/doc/gitaly-backup.md
+++ b/doc/gitaly-backup.md
@@ -49,8 +49,8 @@ Gitaly and Gitaly Cluster.
| `-path` | string | yes | Directory where the backup files will be created. |
| `-parallel` | integer | no | Maximum number of parallel backups. |
| `-parallel-storage` | integer | no | Maximum number of parallel backups per storage. |
- | `-id` | string | no | Used by the locator to determine a unique path for the backup when a full backup is created. |
- | `-locator` | string | no | Determines the file-system layout. Any of `legacy`, `pointer` (default `legacy`). Note: The feature is not ready for production use. |
+ | `-id` | string | no | Used to determine a unique path for the backup when a full backup is created. |
+ | `-layout` | string | no | Determines the file-system layout. Any of `legacy`, `pointer` (default `legacy`). Note: The feature is not ready for production use. |
| `-incremental` | bool | no | Determines if an incremental backup should be created. Note: The feature is not ready for production use. |
## Directly restore repository data
@@ -99,7 +99,7 @@ Gitaly and Gitaly Cluster.
| `-path` | string | yes | Directory where the backup files are stored. |
| `-parallel` | integer | no | Maximum number of parallel restores. |
| `-parallel-storage` | integer | no | Maximum number of parallel restores per storage. |
- | `-locator` | string | no | Determines the file-system layout. Any of `legacy`, `pointer` (default `legacy`). Note: The feature is not ready for production use. |
+ | `-layout` | string | no | Determines the file-system layout. Any of `legacy`, `pointer` (default `legacy`). Note: The feature is not ready for production use. |
## How Git repository backups work
diff --git a/internal/backup/backup.go b/internal/backup/backup.go
index 5dc959dd2..7ff10deeb 100644
--- a/internal/backup/backup.go
+++ b/internal/backup/backup.go
@@ -103,9 +103,9 @@ func ResolveSink(ctx context.Context, path string) (Sink, error) {
}
// ResolveLocator returns a locator implementation based on a locator identifier.
-func ResolveLocator(locator string, sink Sink) (Locator, error) {
+func ResolveLocator(layout string, sink Sink) (Locator, error) {
legacy := LegacyLocator{}
- switch locator {
+ switch layout {
case "legacy":
return legacy, nil
case "pointer":
@@ -114,7 +114,7 @@ func ResolveLocator(locator string, sink Sink) (Locator, error) {
Fallback: legacy,
}, nil
default:
- return nil, fmt.Errorf("unknown locator: %q", locator)
+ return nil, fmt.Errorf("unknown layout: %q", layout)
}
}
diff --git a/internal/backup/backup_test.go b/internal/backup/backup_test.go
index dbef8de9b..b7226ff93 100644
--- a/internal/backup/backup_test.go
+++ b/internal/backup/backup_test.go
@@ -651,18 +651,18 @@ func TestResolveSink(t *testing.T) {
func TestResolveLocator(t *testing.T) {
for _, tc := range []struct {
- locator string
+ layout string
expectedErr string
}{
- {locator: "legacy"},
- {locator: "pointer"},
+ {layout: "legacy"},
+ {layout: "pointer"},
{
- locator: "unknown",
- expectedErr: "unknown locator: \"unknown\"",
+ layout: "unknown",
+ expectedErr: "unknown layout: \"unknown\"",
},
} {
- t.Run(tc.locator, func(t *testing.T) {
- l, err := ResolveLocator(tc.locator, nil)
+ t.Run(tc.layout, func(t *testing.T) {
+ l, err := ResolveLocator(tc.layout, nil)
if tc.expectedErr == "" {
require.NoError(t, err)