mirror of
https://github.com/restic/restic.git
synced 2025-12-10 07:21:55 +00:00
Rename package 'server' to 'repo'
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/pack"
|
||||
"github.com/restic/restic/server"
|
||||
"github.com/restic/restic/repo"
|
||||
)
|
||||
|
||||
type CmdCat struct{}
|
||||
@@ -107,7 +107,7 @@ func (cmd CmdCat) Execute(args []string) error {
|
||||
|
||||
dec := json.NewDecoder(rd)
|
||||
|
||||
var key server.Key
|
||||
var key repo.Key
|
||||
err = dec.Decode(&key)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/server"
|
||||
"github.com/restic/restic/repo"
|
||||
)
|
||||
|
||||
type findResult struct {
|
||||
@@ -59,7 +59,7 @@ func parseTime(str string) (time.Time, error) {
|
||||
return time.Time{}, fmt.Errorf("unable to parse time: %q", str)
|
||||
}
|
||||
|
||||
func (c CmdFind) findInTree(s *server.Server, id backend.ID, path string) ([]findResult, error) {
|
||||
func (c CmdFind) findInTree(s *repo.Server, id backend.ID, path string) ([]findResult, error) {
|
||||
debug.Log("restic.find", "checking tree %v\n", id)
|
||||
tree, err := restic.LoadTree(s, id)
|
||||
if err != nil {
|
||||
@@ -105,7 +105,7 @@ func (c CmdFind) findInTree(s *server.Server, id backend.ID, path string) ([]fin
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func (c CmdFind) findInSnapshot(s *server.Server, name string) error {
|
||||
func (c CmdFind) findInSnapshot(s *repo.Server, name string) error {
|
||||
debug.Log("restic.find", "searching in snapshot %s\n for entries within [%s %s]", name, c.oldest, c.newest)
|
||||
|
||||
id, err := backend.ParseID(name)
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/restic/restic/crypto"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/pack"
|
||||
"github.com/restic/restic/server"
|
||||
"github.com/restic/restic/repo"
|
||||
)
|
||||
|
||||
type CmdFsck struct {
|
||||
@@ -34,7 +34,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func fsckFile(opts CmdFsck, s *server.Server, IDs []backend.ID) (uint64, error) {
|
||||
func fsckFile(opts CmdFsck, s *repo.Server, IDs []backend.ID) (uint64, error) {
|
||||
debug.Log("restic.fsckFile", "checking file %v", IDs)
|
||||
var bytes uint64
|
||||
|
||||
@@ -77,7 +77,7 @@ func fsckFile(opts CmdFsck, s *server.Server, IDs []backend.ID) (uint64, error)
|
||||
return bytes, nil
|
||||
}
|
||||
|
||||
func fsckTree(opts CmdFsck, s *server.Server, id backend.ID) error {
|
||||
func fsckTree(opts CmdFsck, s *repo.Server, id backend.ID) error {
|
||||
debug.Log("restic.fsckTree", "checking tree %v", id.Str())
|
||||
|
||||
tree, err := restic.LoadTree(s, id)
|
||||
@@ -157,7 +157,7 @@ func fsckTree(opts CmdFsck, s *server.Server, id backend.ID) error {
|
||||
return firstErr
|
||||
}
|
||||
|
||||
func fsckSnapshot(opts CmdFsck, s *server.Server, id backend.ID) error {
|
||||
func fsckSnapshot(opts CmdFsck, s *repo.Server, id backend.ID) error {
|
||||
debug.Log("restic.fsck", "checking snapshot %v\n", id)
|
||||
|
||||
sn, err := restic.LoadSnapshot(s, id)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/server"
|
||||
"github.com/restic/restic/repo"
|
||||
)
|
||||
|
||||
type CmdKey struct{}
|
||||
@@ -21,7 +21,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func listKeys(s *server.Server) error {
|
||||
func listKeys(s *repo.Server) error {
|
||||
tab := NewTable()
|
||||
tab.Header = fmt.Sprintf(" %-10s %-10s %-10s %s", "ID", "User", "Host", "Created")
|
||||
tab.RowFormat = "%s%-10s %-10s %-10s %s"
|
||||
@@ -35,7 +35,7 @@ func listKeys(s *server.Server) error {
|
||||
defer close(done)
|
||||
|
||||
for name := range s.List(backend.Key, done) {
|
||||
k, err := server.LoadKey(s, name)
|
||||
k, err := repo.LoadKey(s, name)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "LoadKey() failed: %v\n", err)
|
||||
continue
|
||||
@@ -56,7 +56,7 @@ func listKeys(s *server.Server) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func addKey(s *server.Server) error {
|
||||
func addKey(s *repo.Server) error {
|
||||
pw := readPassword("RESTIC_NEWPASSWORD", "enter password for new key: ")
|
||||
pw2 := readPassword("RESTIC_NEWPASSWORD", "enter password again: ")
|
||||
|
||||
@@ -64,7 +64,7 @@ func addKey(s *server.Server) error {
|
||||
return errors.New("passwords do not match")
|
||||
}
|
||||
|
||||
id, err := server.AddKey(s, pw, s.Key())
|
||||
id, err := repo.AddKey(s, pw, s.Key())
|
||||
if err != nil {
|
||||
return fmt.Errorf("creating new key failed: %v\n", err)
|
||||
}
|
||||
@@ -74,7 +74,7 @@ func addKey(s *server.Server) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func deleteKey(s *server.Server, name string) error {
|
||||
func deleteKey(s *repo.Server, name string) error {
|
||||
if name == s.KeyName() {
|
||||
return errors.New("refusing to remove key currently used to access repository")
|
||||
}
|
||||
@@ -88,7 +88,7 @@ func deleteKey(s *server.Server, name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func changePassword(s *server.Server) error {
|
||||
func changePassword(s *repo.Server) error {
|
||||
pw := readPassword("RESTIC_NEWPASSWORD", "enter password for new key: ")
|
||||
pw2 := readPassword("RESTIC_NEWPASSWORD", "enter password again: ")
|
||||
|
||||
@@ -97,7 +97,7 @@ func changePassword(s *server.Server) error {
|
||||
}
|
||||
|
||||
// add new key
|
||||
id, err := server.AddKey(s, pw, s.Key())
|
||||
id, err := repo.AddKey(s, pw, s.Key())
|
||||
if err != nil {
|
||||
return fmt.Errorf("creating new key failed: %v\n", err)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/server"
|
||||
"github.com/restic/restic/repo"
|
||||
)
|
||||
|
||||
type CmdLs struct{}
|
||||
@@ -38,7 +38,7 @@ func printNode(prefix string, n *restic.Node) string {
|
||||
}
|
||||
}
|
||||
|
||||
func printTree(prefix string, s *server.Server, id backend.ID) error {
|
||||
func printTree(prefix string, s *repo.Server, id backend.ID) error {
|
||||
tree, err := restic.LoadTree(s, id)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/restic/restic/backend/local"
|
||||
"github.com/restic/restic/backend/sftp"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/server"
|
||||
"github.com/restic/restic/repo"
|
||||
)
|
||||
|
||||
var version = "compiled manually"
|
||||
@@ -72,7 +72,7 @@ func (cmd CmdInit) Execute(args []string) error {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
s := server.NewServer(be)
|
||||
s := repo.NewServer(be)
|
||||
err = s.Init(pw)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "creating key in backend at %s failed: %v\n", opts.Repo, err)
|
||||
@@ -133,7 +133,7 @@ func create(u string) (backend.Backend, error) {
|
||||
return sftp.Create(url.Path[1:], "ssh", args...)
|
||||
}
|
||||
|
||||
func OpenRepo() (*server.Server, error) {
|
||||
func OpenRepo() (*repo.Server, error) {
|
||||
if opts.Repo == "" {
|
||||
return nil, errors.New("Please specify repository location (-r)")
|
||||
}
|
||||
@@ -143,7 +143,7 @@ func OpenRepo() (*server.Server, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s := server.NewServer(be)
|
||||
s := repo.NewServer(be)
|
||||
|
||||
err = s.SearchKey(readPassword("RESTIC_PASSWORD", "enter password for repository: "))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user