2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-02 11:46:36 +00:00

backend/layout: Add Basedir()

This commit is contained in:
Alexander Neumann 2017-04-10 23:21:23 +02:00
parent e2af5890f3
commit 320c22f1f5
4 changed files with 16 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import (
type Layout interface {
Filename(restic.Handle) string
Dirname(restic.Handle) string
Basedir(restic.FileType) string
Paths() []string
}

View File

@ -34,3 +34,8 @@ func (l *CloudLayout) Paths() (dirs []string) {
}
return dirs
}
// Basedir returns the base dir name for files of type t.
func (l *CloudLayout) Basedir(t restic.FileType) string {
return l.Join(l.Path, cloudLayoutPaths[t])
}

View File

@ -47,3 +47,8 @@ func (l *DefaultLayout) Paths() (dirs []string) {
}
return dirs
}
// Basedir returns the base dir name for type t.
func (l *DefaultLayout) Basedir(t restic.FileType) string {
return l.Join(l.Path, defaultLayoutPaths[t])
}

View File

@ -40,3 +40,8 @@ func (l *S3Layout) Paths() (dirs []string) {
}
return dirs
}
// Basedir returns the base dir name for type t.
func (l *S3Layout) Basedir(t restic.FileType) string {
return l.Join(l.Path, s3LayoutPaths[t])
}