mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 12:55:18 +00:00
Rename snapshot.Content -> snapshot.Tree
This commit is contained in:
parent
73be0d5b18
commit
202984a93f
@ -384,7 +384,7 @@ func (arch *Archiver) LoadTree(path string, parentSnapshot backend.ID) (*Tree, e
|
|||||||
return nil, arrar.Annotate(err, "load old snapshot")
|
return nil, arrar.Annotate(err, "load old snapshot")
|
||||||
}
|
}
|
||||||
|
|
||||||
if snapshot.Content == nil {
|
if snapshot.Tree == nil {
|
||||||
return nil, errors.New("snapshot without tree!")
|
return nil, errors.New("snapshot without tree!")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ func (arch *Archiver) LoadTree(path string, parentSnapshot backend.ID) (*Tree, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
oldTree, err = LoadTree(arch.ch, snapshot.Content)
|
oldTree, err = LoadTree(arch.ch, snapshot.Tree)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, arrar.Annotate(err, "load old tree")
|
return nil, arrar.Annotate(err, "load old tree")
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ func (arch *Archiver) Snapshot(dir string, t *Tree, parentSnapshot backend.ID) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
sn.Content = blob.ID
|
sn.Tree = blob.ID
|
||||||
|
|
||||||
// save bloblist
|
// save bloblist
|
||||||
blob, err = arch.SaveJSON(backend.Map, arch.bl)
|
blob, err = arch.SaveJSON(backend.Map, arch.bl)
|
||||||
|
@ -81,7 +81,7 @@ func fsck_snapshot(be backend.Server, key *restic.Key, id backend.ID) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if sn.Content == nil {
|
if sn.Tree == nil {
|
||||||
return fmt.Errorf("snapshot %v has no content", sn.ID)
|
return fmt.Errorf("snapshot %v has no content", sn.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ func fsck_snapshot(be backend.Server, key *restic.Key, id backend.ID) error {
|
|||||||
return fmt.Errorf("snapshot %v has no map", sn.ID)
|
return fmt.Errorf("snapshot %v has no map", sn.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fsckTree(ch, sn.Content)
|
return fsckTree(ch, sn.Tree)
|
||||||
}
|
}
|
||||||
|
|
||||||
func commandFsck(be backend.Server, key *restic.Key, args []string) error {
|
func commandFsck(be backend.Server, key *restic.Key, args []string) error {
|
||||||
|
@ -74,5 +74,5 @@ func commandLs(be backend.Server, key *restic.Key, args []string) error {
|
|||||||
|
|
||||||
fmt.Printf("snapshot of %s at %s:\n", sn.Dir, sn.Time)
|
fmt.Printf("snapshot of %s at %s:\n", sn.Dir, sn.Time)
|
||||||
|
|
||||||
return print_tree("", ch, sn.Content)
|
return print_tree("", ch, sn.Tree)
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ func (res *Restorer) RestoreTo(dir string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.to(dir, res.sn.Content)
|
return res.to(dir, res.sn.Tree)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (res *Restorer) Snapshot() *Snapshot {
|
func (res *Restorer) Snapshot() *Snapshot {
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
type Snapshot struct {
|
type Snapshot struct {
|
||||||
Time time.Time `json:"time"`
|
Time time.Time `json:"time"`
|
||||||
Parent backend.ID `json:"parent,omitempty"`
|
Parent backend.ID `json:"parent,omitempty"`
|
||||||
Content backend.ID `json:"content"`
|
Tree backend.ID `json:"tree"`
|
||||||
Map backend.ID `json:"map"`
|
Map backend.ID `json:"map"`
|
||||||
Dir string `json:"dir"`
|
Dir string `json:"dir"`
|
||||||
Hostname string `json:"hostname,omitempty"`
|
Hostname string `json:"hostname,omitempty"`
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func testSnapshot(t *testing.T, be backend.Server) {
|
func testSnapshot(t *testing.T, be backend.Server) {
|
||||||
var err error
|
var err error
|
||||||
sn := restic.NewSnapshot("/home/foobar")
|
sn := restic.NewSnapshot("/home/foobar")
|
||||||
sn.Content, err = backend.ParseID("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2")
|
sn.Tree, err = backend.ParseID("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2")
|
||||||
ok(t, err)
|
ok(t, err)
|
||||||
sn.Time, err = time.Parse(time.RFC3339Nano, "2014-08-03T17:49:05.378595539+02:00")
|
sn.Time, err = time.Parse(time.RFC3339Nano, "2014-08-03T17:49:05.378595539+02:00")
|
||||||
ok(t, err)
|
ok(t, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user