From 7cf8f59987889839858e2ecaf418f839d934612c Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 7 Jun 2017 21:59:41 +0200 Subject: [PATCH] layout: Add String() and Name() --- src/restic/backend/layout.go | 1 + src/restic/backend/layout_default.go | 9 +++++++++ src/restic/backend/layout_rest.go | 9 +++++++++ src/restic/backend/layout_s3legacy.go | 9 +++++++++ 4 files changed, 28 insertions(+) diff --git a/src/restic/backend/layout.go b/src/restic/backend/layout.go index 3d0953de8..b58f290be 100644 --- a/src/restic/backend/layout.go +++ b/src/restic/backend/layout.go @@ -17,6 +17,7 @@ type Layout interface { Dirname(restic.Handle) string Basedir(restic.FileType) string Paths() []string + Name() string } // Filesystem is the abstraction of a file system used for a backend. diff --git a/src/restic/backend/layout_default.go b/src/restic/backend/layout_default.go index 665b85531..9b57657b5 100644 --- a/src/restic/backend/layout_default.go +++ b/src/restic/backend/layout_default.go @@ -19,6 +19,15 @@ var defaultLayoutPaths = map[restic.FileType]string{ restic.KeyFile: "keys", } +func (l *DefaultLayout) String() string { + return "" +} + +// Name returns the name for this layout. +func (l *DefaultLayout) Name() string { + return "default" +} + // Dirname returns the directory path for a given file type and name. func (l *DefaultLayout) Dirname(h restic.Handle) string { p := defaultLayoutPaths[h.Type] diff --git a/src/restic/backend/layout_rest.go b/src/restic/backend/layout_rest.go index 2d01ece79..007be37c8 100644 --- a/src/restic/backend/layout_rest.go +++ b/src/restic/backend/layout_rest.go @@ -11,6 +11,15 @@ type RESTLayout struct { var restLayoutPaths = defaultLayoutPaths +func (l *RESTLayout) String() string { + return "" +} + +// Name returns the name for this layout. +func (l *RESTLayout) Name() string { + return "rest" +} + // Dirname returns the directory path for a given file type and name. func (l *RESTLayout) Dirname(h restic.Handle) string { if h.Type == restic.ConfigFile { diff --git a/src/restic/backend/layout_s3legacy.go b/src/restic/backend/layout_s3legacy.go index 601d29bc5..d9d7ab212 100644 --- a/src/restic/backend/layout_s3legacy.go +++ b/src/restic/backend/layout_s3legacy.go @@ -18,6 +18,15 @@ var s3LayoutPaths = map[restic.FileType]string{ restic.KeyFile: "key", } +func (l *S3LegacyLayout) String() string { + return "" +} + +// Name returns the name for this layout. +func (l *S3LegacyLayout) Name() string { + return "s3legacy" +} + // join calls Join with the first empty elements removed. func (l *S3LegacyLayout) join(url string, items ...string) string { for len(items) > 0 && items[0] == "" {