From 782b740c95e2f591448d9a0bc83928ea799bf44c Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 26 Mar 2017 22:14:00 +0200 Subject: [PATCH] local: Remove unused code --- src/restic/backend/local/local.go | 38 +------------------------------ 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/src/restic/backend/local/local.go b/src/restic/backend/local/local.go index 72c3f6e54..4ddada847 100644 --- a/src/restic/backend/local/local.go +++ b/src/restic/backend/local/local.go @@ -2,7 +2,6 @@ package local import ( "io" - "io/ioutil" "os" "path/filepath" "restic" @@ -20,20 +19,9 @@ type Local struct { backend.Layout } +// ensure statically that *Local implements restic.Backend. var _ restic.Backend = &Local{} -func paths(dir string) []string { - return []string{ - dir, - filepath.Join(dir, backend.Paths.Data), - filepath.Join(dir, backend.Paths.Snapshots), - filepath.Join(dir, backend.Paths.Index), - filepath.Join(dir, backend.Paths.Locks), - filepath.Join(dir, backend.Paths.Keys), - filepath.Join(dir, backend.Paths.Temp), - } -} - // Open opens the local backend as specified by config. func Open(cfg Config) (*Local, error) { be := &Local{Config: cfg} @@ -86,30 +74,6 @@ func (b *Local) Location() string { return b.Path } -// copyToTempfile saves p into a tempfile in tempdir. -func copyToTempfile(tempdir string, rd io.Reader) (filename string, err error) { - tmpfile, err := ioutil.TempFile(tempdir, "temp-") - if err != nil { - return "", errors.Wrap(err, "TempFile") - } - - _, err = io.Copy(tmpfile, rd) - if err != nil { - return "", errors.Wrap(err, "Write") - } - - if err = tmpfile.Sync(); err != nil { - return "", errors.Wrap(err, "Syncn") - } - - err = tmpfile.Close() - if err != nil { - return "", errors.Wrap(err, "Close") - } - - return tmpfile.Name(), nil -} - // Save stores data in the backend at the handle. func (b *Local) Save(h restic.Handle, rd io.Reader) (err error) { debug.Log("Save %v", h)