mirror of
https://github.com/restic/restic.git
synced 2025-08-23 04:07:25 +00:00
archiver: unify FutureTree/File into futureNode
There is no real difference between the FutureTree and FutureFile structs. However, differentiating both increases the size of the FutureNode struct. The FutureNode struct is now only 16 bytes large on 64bit platforms. That way is has a very low overhead if the corresponding file/directory was not processed yet. There is a special case for nodes that were reused from the parent snapshot, as a go channel seems to have 96 bytes overhead which would result in a memory usage regression.
This commit is contained in:
@@ -64,7 +64,7 @@ func TestFileSaver(t *testing.T) {
|
||||
testFs := fs.Local{}
|
||||
s, ctx, wg := startFileSaver(ctx, t)
|
||||
|
||||
var results []FutureFile
|
||||
var results []FutureNode
|
||||
|
||||
for _, filename := range files {
|
||||
f, err := testFs.Open(filename)
|
||||
@@ -77,14 +77,14 @@ func TestFileSaver(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
ff := s.Save(ctx, filename, f, fi, startFn, completeFn)
|
||||
ff := s.Save(ctx, filename, filename, f, fi, startFn, completeFn)
|
||||
results = append(results, ff)
|
||||
}
|
||||
|
||||
for _, file := range results {
|
||||
file.Wait(ctx)
|
||||
if file.Err() != nil {
|
||||
t.Errorf("unable to save file: %v", file.Err())
|
||||
fnr := file.take(ctx)
|
||||
if fnr.err != nil {
|
||||
t.Errorf("unable to save file: %v", fnr.err)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user