When restore, can restic just traverse the tree only once?

When restore, restic first traverse the tree for directory creation and file data recovery, and then traverse the tree for metadata recovery. So, can restic use only once traverse containers file data recovery and metadata recovery?

The code : restic/restorer.go at master · restic/restic · GitHub

It’s not possible to avoid the two passes with the current restorer design. What are you trying to achieve?

Traverse the tree then restore the file, at the same time recover file’s metadata.
I don’t understand why it’s not possible, becase of the special metadata or special file?

What is your use case? What are you trying to do?

Or is it just a question to understand the code?

restic first has to create the directory structure necessary to restore files. Then all file content is restored in parallel, this is done to achieve a decent restore performance. And afterwards the file and directory metadata is restored.

Scale the traverse and improve performance, this is my motivation

Restic can record the metadata in the first traverse, and after the file content has been restored then restore the file’s metadata, which i think maybe feasible. Some code details that i am not considered may not support this.