From 5c62bce5eb0e774b8f19f0cfd0e7de8fddfb05fb Mon Sep 17 00:00:00 2001 From: Julio Lopez Date: Thu, 19 Dec 2019 16:16:09 -0800 Subject: [PATCH] snapshot.ManifestType const --- snapshot/manager.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/snapshot/manager.go b/snapshot/manager.go index 1f3c7e7f3..aa6b51073 100644 --- a/snapshot/manager.go +++ b/snapshot/manager.go @@ -11,12 +11,15 @@ "github.com/kopia/kopia/repo/manifest" ) +// ManifestType is the value of the "type" label for snapshot manifests +const ManifestType = "snapshot" + var log = kopialogging.Logger("kopia/snapshot") // ListSources lists all snapshot sources in a given repository. func ListSources(ctx context.Context, rep *repo.Repository) ([]SourceInfo, error) { items, err := rep.Manifests.Find(ctx, map[string]string{ - "type": "snapshot", + "type": ManifestType, }) if err != nil { return nil, errors.Wrap(err, "unable to find manifest entries") @@ -41,7 +44,7 @@ func sourceInfoFromLabels(labels map[string]string) SourceInfo { func sourceInfoToLabels(si SourceInfo) map[string]string { return map[string]string{ - "type": "snapshot", + "type": ManifestType, "hostname": si.Host, "username": si.UserName, "path": si.Path, @@ -133,7 +136,7 @@ func LoadSnapshots(ctx context.Context, rep *repo.Repository, manifestIDs []mani // ListSnapshotManifests returns the list of snapshot manifests for a given source or all sources if nil. func ListSnapshotManifests(ctx context.Context, rep *repo.Repository, src *SourceInfo) ([]manifest.ID, error) { labels := map[string]string{ - "type": "snapshot", + "type": ManifestType, } if src != nil {