Commit 998d2ef8 authored by ale's avatar ale
Browse files

Rename some files for clarity

parent e977bcbb
...@@ -123,3 +123,11 @@ func expandVars(s string, backup Backup, ds Dataset, atom Atom) string { ...@@ -123,3 +123,11 @@ func expandVars(s string, backup Backup, ds Dataset, atom Atom) string {
} }
}) })
} }
func makeSingleAtomDataset(ds Dataset, atom Atom) Dataset {
return Dataset{
Name: filepath.Join(ds.Name, atom.Name),
Handler: ds.Handler,
Atoms: []Atom{atom},
}
}
...@@ -105,7 +105,7 @@ func (d *dummyMetadataStore) AddDataset(_ context.Context, backup Backup, ds Dat ...@@ -105,7 +105,7 @@ func (d *dummyMetadataStore) AddDataset(_ context.Context, backup Backup, ds Dat
return nil return nil
} }
func TestBackup(t *testing.T) { func TestManager_Backup(t *testing.T) {
store := &dummyMetadataStore{} store := &dummyMetadataStore{}
repoSpec := RepositorySpec{ repoSpec := RepositorySpec{
Name: "main", Name: "main",
......
...@@ -38,6 +38,11 @@ func createTempDirWithData(t *testing.T) string { ...@@ -38,6 +38,11 @@ func createTempDirWithData(t *testing.T) string {
// nolint: gocyclo // nolint: gocyclo
func TestRestic(t *testing.T) { func TestRestic(t *testing.T) {
// Check that we can actually run restic.
if err := checkResticVersion("restic"); err != nil {
t.Skip("can't run restic: ", err)
}
store := &dummyMetadataStore{} store := &dummyMetadataStore{}
tmpdir := createTempDirWithData(t) tmpdir := createTempDirWithData(t)
......
...@@ -96,3 +96,11 @@ func runAtomsCommand(ctx context.Context, cmd string) ([]Atom, error) { ...@@ -96,3 +96,11 @@ func runAtomsCommand(ctx context.Context, cmd string) ([]Atom, error) {
} }
return atoms, scanner.Err() return atoms, scanner.Err()
} }
func normalizeDataset(ds Dataset) Dataset {
// If the Dataset has no atoms, add an empty one.
if len(ds.Atoms) == 0 {
ds.Atoms = []Atom{Atom{}}
}
return ds
}
...@@ -4,7 +4,6 @@ import ( ...@@ -4,7 +4,6 @@ import (
"context" "context"
"fmt" "fmt"
"io" "io"
"path/filepath"
"regexp" "regexp"
"strings" "strings"
"time" "time"
...@@ -58,22 +57,6 @@ type Dataset struct { ...@@ -58,22 +57,6 @@ type Dataset struct {
Atoms []Atom `json:"atoms"` Atoms []Atom `json:"atoms"`
} }
func makeSingleAtomDataset(ds Dataset, atom Atom) Dataset {
return Dataset{
Name: filepath.Join(ds.Name, atom.Name),
Handler: ds.Handler,
Atoms: []Atom{atom},
}
}
func normalizeDataset(ds Dataset) Dataset {
// If the Dataset has no atoms, add an empty one.
if len(ds.Atoms) == 0 {
ds.Atoms = []Atom{Atom{}}
}
return ds
}
// FindRequest specifies search criteria for atoms. // FindRequest specifies search criteria for atoms.
type FindRequest struct { type FindRequest struct {
Pattern string `json:"pattern"` Pattern string `json:"pattern"`
...@@ -97,12 +80,6 @@ type Version struct { ...@@ -97,12 +80,6 @@ type Version struct {
Backup Backup `json:"backup"` Backup Backup `json:"backup"`
} }
// FindResponseEntry groups datasets and their versions.
type FindResponseEntry struct {
Dataset Dataset `json:"dataset"`
Versions []Backup `json:"versions"`
}
// MetadataStore is the client interface to the global metadata store. // MetadataStore is the client interface to the global metadata store.
type MetadataStore interface { type MetadataStore interface {
// Find the datasets that match a specific criteria. Only // Find the datasets that match a specific criteria. Only
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment