mirror of https://github.com/restic/restic.git
local: Remove unused code
This commit is contained in:
parent
3fd6fa6f86
commit
782b740c95
|
@ -2,7 +2,6 @@ package local
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"restic"
|
"restic"
|
||||||
|
@ -20,20 +19,9 @@ type Local struct {
|
||||||
backend.Layout
|
backend.Layout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ensure statically that *Local implements restic.Backend.
|
||||||
var _ restic.Backend = &Local{}
|
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.
|
// Open opens the local backend as specified by config.
|
||||||
func Open(cfg Config) (*Local, error) {
|
func Open(cfg Config) (*Local, error) {
|
||||||
be := &Local{Config: cfg}
|
be := &Local{Config: cfg}
|
||||||
|
@ -86,30 +74,6 @@ func (b *Local) Location() string {
|
||||||
return b.Path
|
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.
|
// Save stores data in the backend at the handle.
|
||||||
func (b *Local) Save(h restic.Handle, rd io.Reader) (err error) {
|
func (b *Local) Save(h restic.Handle, rd io.Reader) (err error) {
|
||||||
debug.Log("Save %v", h)
|
debug.Log("Save %v", h)
|
||||||
|
|
Loading…
Reference in New Issue