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>2023-11-22 04:40:50 +0300
committerJames Fargher <jfargher@gitlab.com>2023-12-11 23:04:15 +0300
commita0cfeed170c51a933e825dc3d24100b3a795c78b (patch)
tree67dcc4e732221edb7d37f4aa437aa9519b5e37a7
parente4c3cf70dac0562f2ddfb5f851cfe3f7f40c17f9 (diff)
backup: Rename ManifestLocator to ManifestInteroptLocator
Soon we will introduce a real ManifestLocator that will have no fallback. The goal is to add manifests for all existing layouts to smooth this transition. We can't just modify this existing layout because we want to be able to add a new locator to the locator option on the gitaly-backup commandline. This is so that we can coordinate changing tests on gitlab-rails with the release of the full manifest locator.
-rw-r--r--internal/backup/backup.go2
-rw-r--r--internal/backup/locator.go18
-rw-r--r--internal/backup/locator_test.go10
3 files changed, 16 insertions, 14 deletions
diff --git a/internal/backup/backup.go b/internal/backup/backup.go
index 5eed0724a..cb1265a5e 100644
--- a/internal/backup/backup.go
+++ b/internal/backup/backup.go
@@ -148,7 +148,7 @@ func ResolveLocator(layout string, sink Sink) (Locator, error) {
return nil, fmt.Errorf("unknown layout: %q", layout)
}
- locator = ManifestLocator{
+ locator = ManifestInteropLocator{
Sink: sink,
Fallback: locator,
}
diff --git a/internal/backup/locator.go b/internal/backup/locator.go
index 1e1c42550..b2952a5f7 100644
--- a/internal/backup/locator.go
+++ b/internal/backup/locator.go
@@ -267,29 +267,31 @@ func (l PointerLocator) writeLatest(ctx context.Context, path, target string) (r
return nil
}
-// ManifestLocator locates backup paths based on manifest files that are
+// ManifestInteropLocator locates backup paths based on manifest files that are
// written to a predetermined path:
//
// manifests/<repo_storage_name>/<repo_relative_path>/<backup_id>.toml
//
-// It relies on Fallback to determine paths of new backups.
-type ManifestLocator struct {
+// This layout adds manifests to existing layouts so that all backups can be
+// eventually migrated to manifest files only. It relies on Fallback to
+// determine paths of new backups.
+type ManifestInteropLocator struct {
Sink Sink
Fallback Locator
}
// BeginFull passes through to Fallback
-func (l ManifestLocator) BeginFull(ctx context.Context, repo storage.Repository, backupID string) *Backup {
+func (l ManifestInteropLocator) BeginFull(ctx context.Context, repo storage.Repository, backupID string) *Backup {
return l.Fallback.BeginFull(ctx, repo, backupID)
}
// BeginIncremental passes through to Fallback
-func (l ManifestLocator) BeginIncremental(ctx context.Context, repo storage.Repository, backupID string) (*Backup, error) {
+func (l ManifestInteropLocator) BeginIncremental(ctx context.Context, repo storage.Repository, backupID string) (*Backup, error) {
return l.Fallback.BeginIncremental(ctx, repo, backupID)
}
// Commit passes through to Fallback, then writes a manifest file for the backup.
-func (l ManifestLocator) Commit(ctx context.Context, backup *Backup) (returnErr error) {
+func (l ManifestInteropLocator) Commit(ctx context.Context, backup *Backup) (returnErr error) {
if err := l.Fallback.Commit(ctx, backup); err != nil {
return err
}
@@ -312,13 +314,13 @@ func (l ManifestLocator) Commit(ctx context.Context, backup *Backup) (returnErr
}
// FindLatest passes through to Fallback
-func (l ManifestLocator) FindLatest(ctx context.Context, repo storage.Repository) (*Backup, error) {
+func (l ManifestInteropLocator) FindLatest(ctx context.Context, repo storage.Repository) (*Backup, error) {
return l.Fallback.FindLatest(ctx, repo)
}
// Find loads the manifest for the provided repo and backupID. If this manifest
// does not exist, the fallback is used.
-func (l ManifestLocator) Find(ctx context.Context, repo storage.Repository, backupID string) (*Backup, error) {
+func (l ManifestInteropLocator) Find(ctx context.Context, repo storage.Repository, backupID string) (*Backup, error) {
f, err := l.Sink.GetReader(ctx, manifestPath(repo, backupID))
switch {
case errors.Is(err, ErrDoesntExist):
diff --git a/internal/backup/locator_test.go b/internal/backup/locator_test.go
index 90cac3664..cb7f5c4ed 100644
--- a/internal/backup/locator_test.go
+++ b/internal/backup/locator_test.go
@@ -406,7 +406,7 @@ func TestPointerLocator(t *testing.T) {
})
}
-func TestManifestLocator(t *testing.T) {
+func TestManifestInteropLocator(t *testing.T) {
t.Parallel()
const backupID = "abc123"
@@ -428,7 +428,7 @@ func TestManifestLocator(t *testing.T) {
var l Locator = PointerLocator{
Sink: sink,
}
- l = ManifestLocator{
+ l = ManifestInteropLocator{
Sink: sink,
Fallback: l,
}
@@ -460,7 +460,7 @@ custom_hooks_path = '%[1]s/%[2]s/001.custom_hooks.tar'
var l Locator = PointerLocator{
Sink: sink,
}
- l = ManifestLocator{
+ l = ManifestInteropLocator{
Sink: sink,
Fallback: l,
}
@@ -486,7 +486,7 @@ custom_hooks_path = '%[1]s/%[2]s/002.custom_hooks.tar'
})
}
-func TestManifestLocator_Find(t *testing.T) {
+func TestManifestInteropLocator_Find(t *testing.T) {
t.Parallel()
for _, tc := range []struct {
@@ -593,7 +593,7 @@ custom_hooks_path = 'path/to/002.custom_hooks.tar'
var l Locator = PointerLocator{
Sink: sink,
}
- l = ManifestLocator{
+ l = ManifestInteropLocator{
Sink: sink,
Fallback: l,
}