2018-07-11 19:18:01 +00:00
|
|
|
// Package restorer contains code to restore data from a repository.
|
|
|
|
//
|
|
|
|
// The Restorer tries to keep the number of backend requests minimal. It does
|
|
|
|
// this by downloading all required blobs of a pack file with a single backend
|
|
|
|
// request and avoiding repeated downloads of the same pack. In addition,
|
|
|
|
// several pack files are fetched concurrently.
|
|
|
|
//
|
2019-11-27 12:22:38 +00:00
|
|
|
// Here is high-level pseudo-code of how the Restorer attempts to achieve
|
2018-07-11 19:18:01 +00:00
|
|
|
// these goals:
|
|
|
|
//
|
2022-08-19 17:12:26 +00:00
|
|
|
// while there are packs to process
|
|
|
|
// choose a pack to process [1]
|
|
|
|
// retrieve the pack from the backend [2]
|
|
|
|
// write pack blobs to the files that need them [3]
|
2018-07-11 19:18:01 +00:00
|
|
|
//
|
2019-11-27 12:22:38 +00:00
|
|
|
// Retrieval of repository packs (step [2]) and writing target files (step [3])
|
|
|
|
// are performed concurrently on multiple goroutines.
|
2018-07-11 19:18:01 +00:00
|
|
|
//
|
2019-11-27 12:22:38 +00:00
|
|
|
// Implementation does not guarantee order in which blobs are written to the
|
|
|
|
// target files and, for example, the last blob of a file can be written to the
|
2020-10-05 21:13:38 +00:00
|
|
|
// file before any of the preceding file blobs. It is therefore possible to
|
2019-11-27 12:22:38 +00:00
|
|
|
// have gaps in the data written to the target files if restore fails or
|
|
|
|
// interrupted by the user.
|
2018-07-11 19:18:01 +00:00
|
|
|
package restorer
|