2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 06:46:34 +00:00

Change parameters of LoadTree()

This commit is contained in:
Alexander Neumann 2015-02-17 22:37:34 +01:00
parent 5a16a66973
commit 4d1e7b9f24
5 changed files with 7 additions and 7 deletions

View File

@ -66,7 +66,7 @@ func parseTime(str string) (time.Time, error) {
func (c CmdFind) findInTree(s restic.Server, blob restic.Blob, path string) ([]findResult, error) { func (c CmdFind) findInTree(s restic.Server, blob restic.Blob, path string) ([]findResult, error) {
debug.Log("restic.find", "checking tree %v\n", blob) debug.Log("restic.find", "checking tree %v\n", blob)
tree, err := restic.LoadTree(s, blob) tree, err := restic.LoadTree(s, blob.Storage)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -75,7 +75,7 @@ func fsckFile(opts CmdFsck, s restic.Server, m *restic.Map, IDs []backend.ID) (u
func fsckTree(opts CmdFsck, s restic.Server, blob restic.Blob) error { func fsckTree(opts CmdFsck, s restic.Server, blob restic.Blob) error {
debug.Log("restic.fsck", "checking tree %v\n", blob.ID) debug.Log("restic.fsck", "checking tree %v\n", blob.ID)
tree, err := restic.LoadTree(s, blob) tree, err := restic.LoadTree(s, blob.Storage)
if err != nil { if err != nil {
return err return err
} }

View File

@ -38,7 +38,7 @@ func print_node(prefix string, n *restic.Node) string {
} }
func print_tree(prefix string, s restic.Server, blob restic.Blob) error { func print_tree(prefix string, s restic.Server, blob restic.Blob) error {
tree, err := restic.LoadTree(s, blob) tree, err := restic.LoadTree(s, blob.Storage)
if err != nil { if err != nil {
return err return err
} }

View File

@ -37,7 +37,7 @@ func NewRestorer(s Server, snid backend.ID) (*Restorer, error) {
} }
func (res *Restorer) to(dst string, dir string, treeBlob Blob) error { func (res *Restorer) to(dst string, dir string, treeBlob Blob) error {
tree, err := LoadTree(res.s, treeBlob) tree, err := LoadTree(res.s, treeBlob.Storage)
if err != nil { if err != nil {
return res.Error(dir, nil, arrar.Annotate(err, "LoadTree")) return res.Error(dir, nil, arrar.Annotate(err, "LoadTree"))
} }

View File

@ -32,9 +32,9 @@ func (t Tree) String() string {
return fmt.Sprintf("Tree<%d nodes, %d blobs>", len(t.Nodes), len(t.Map.list)) return fmt.Sprintf("Tree<%d nodes, %d blobs>", len(t.Nodes), len(t.Map.list))
} }
func LoadTree(s Server, blob Blob) (*Tree, error) { func LoadTree(s Server, id backend.ID) (*Tree, error) {
tree := &Tree{} tree := &Tree{}
err := s.LoadJSON(backend.Tree, blob, tree) err := s.LoadJSONID(backend.Tree, id, tree)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -45,7 +45,7 @@ func LoadTree(s Server, blob Blob) (*Tree, error) {
// LoadTreeRecursive loads the tree and all subtrees via s. // LoadTreeRecursive loads the tree and all subtrees via s.
func LoadTreeRecursive(path string, s Server, blob Blob) (*Tree, error) { func LoadTreeRecursive(path string, s Server, blob Blob) (*Tree, error) {
// TODO: load subtrees in parallel // TODO: load subtrees in parallel
tree, err := LoadTree(s, blob) tree, err := LoadTree(s, blob.Storage)
if err != nil { if err != nil {
return nil, err return nil, err
} }