added one test TestPruneSizeMonitoring() which runs a failed backup and then calls prune
to remove the partial snapshot.
cmd/restic/integration_test needed to be modified, since it does not allow multiple calls
to list snapshots.
If in monitoring mode, an active file gets truncated by breaking out of the reead loop
The incomplete file list gets fixed by truncating it to the last non-null ID
The file_saver_test.go needs updating with the repo parameter.
Implementation of limiting the repository size during the backup process.
Introduce option --max-repo-size, which is converted to field
gopts.RepoSizeMax, and handed over to repository.New() in cmd/restic/global.go.
The command prints the current size in Verbosef mode at the beginning and
also at the end, when the repository size has been exceeded.
in saveDir() don't save the directory if the current backup is in repository shutdown mode
In saveTree() don't descend into subdirectories if the current backup is in repository shutdown mode
in Snapshot() add the flag PartialSnapshot to the Snapshot structure, also add tag "partial-snapshot"
to the tag list.
intercept MaxCapacityExceeded errors for all blobs and convert them to "no error" for
all blobs but DataBlobs.
For DataBlobs insert an extra data blob once, with the signature "MaxCapacityExceeded\n"
For all data blob instances with the above error, return a `saveBlobResponse` with an ID of
restic.Hash("MaxCapacityExceeded\n")
This done to maintain the integritry of all newly saved blobs.
If the capacity size limit condition is activated, a TreeBlob is passed through
unharmed, so the new tree can be saved properly.
A DataBlob however, which could be very large in size will be replaced by the
data blob which contains the string "MaxCapacityExceeded\n".
Changed saveAndEncrypt(...) to include tracking of current size and
raising an error "MaxCapacityExceeded" when the limit has been exceeded.
Added CurrentRepositorySize(ctx) to report current size
Added MaxCapacityExceeded() to query if limit has been execced
Added IsRepositoryLimitActive() to query if size monitoring is active
In addition an interface definition added to fulfill the needs of internal/archiver
for accessing repository functions.
The issue descrition has been updated.
Enhancement: create ability to sort output of restic ls -l by
name, size, atime, ctime, mtime, time(=mtime), X(=extension), extension
---------
Co-authored-by: Michael Eischer <michael.eischer@fau.de>