Commit Graph

8847 Commits

Author SHA1 Message Date
Winfried Plappert e7dddb065a restic prune integration tests:
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.
2025-03-05 21:58:34 +00:00
Winfried Plappert b264f0660a restic prune - added function findPartialSnapshots()
findPartialSnapshots collects all partial snapshots and sends the off to
restic.ParallelRemove() to forget them before prune starts working.
2025-03-05 21:55:28 +00:00
Winfried Plappert be6a144503 restic diff, stats, tag - more command which vannot handle partial snapshots
inserted check for partial snapshots
2025-03-05 21:44:34 +00:00
Winfried Plappert 1873780d41 the commands which will definitely not operate on partial snapshots 2025-03-04 16:58:03 +00:00
Winfried Plappert e36b07f78b restic backup - gofmt got me
here is the better version by gofmt
2025-03-04 16:55:05 +00:00
Winfried Plappert 55f3c2e08c restic backup with repository size monitoring: enlarged help description
added function checkPartialSnapshot() so commands working on snapshots
can check ig they can use a given partial snapshot as input.
2025-03-04 16:50:01 +00:00
Winfried Plappert 92fe006ee1 archiver in repository size monitoring mode
archiver.go: add repo parameter to newFileSaver(), remove unneeded check for monitoring check for saveTree

blob_saver.go: remove unneded monitoring check for worker()
2025-03-04 08:43:37 +00:00
Winfried Plappert 812bf976b9 filesaver in repository size monitoring mode
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.
2025-03-04 08:39:53 +00:00
Winfried Plappert 5ae0914b26 repository functions:
repo/repository.go: print limit reached message once, remove unneedef function IsRepositoryLimitActive()
restic/repository.go: remove unnneded interface definition
2025-03-04 08:35:53 +00:00
Winfried Plappert 09fb254134 internal/archiver/blob_saver removed ugly hack to save data blobs
in case of the error "MaxCapacityExceeded", now just ignore it and continue
as before.
2025-03-03 07:00:10 +00:00
Winfried Plappert 1abf1aafc8 restic backup - remove unneeded code and improve error information
remove unneded field RepoSizeMax

Improve code at the end of the run showing if repository capacity has been
exceeded and give current value.
2025-03-03 06:56:03 +00:00
Winfried Plappert 8c35a6d76d restic backup --max-repo-size
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.
2025-03-02 16:19:07 +00:00
Winfried Plappert 62a8f1bd89 changes to internal/archiver/archiver: allow `restic backup` to work with a repo size limitation
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.
2025-03-02 13:08:44 +00:00
Winfried Plappert 767d66474b changed logic for processing failing MaxCapacityExceeded data blobs
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.
2025-03-02 13:01:14 +00:00
Winfried Plappert 612e21d42b restic backup - handle MaxCapacityExceeded while saving a blob
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".
2025-03-02 09:09:43 +00:00
Winfried Plappert bf227e6237 Add field RepoSizeMax to global.go, Add field PartialSnapshot to Snapshot
in preparation to limit repository size during backup.
2025-03-02 09:05:49 +00:00
Winfried Plappert 3d02451498 In preparation for `restic backup --max-repo-size` extend interface definition
of repository to include:
  MaxCapacityExceeded() bool
  IsRepositoryLimitActive() bool
2025-03-02 08:57:52 +00:00
Winfried Plappert 4ffb6f2c55 new implementation of limiting repository size during backup
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.
2025-03-02 08:49:14 +00:00
Michael Eischer de9a040d27
Merge pull request #5256 from abaumg/fix/links-to-backblaze-documentation
Fix links to Backblaze documentation
2025-02-23 21:06:28 +01:00
Andreas Baumgartner 89826ef5ce doc: fix links to Backblaze documentation 2025-02-21 23:43:02 +01:00
Michael Eischer 5ddda7f5e9
Merge pull request #5242 from MichaelEischer/fix-read-stdin-msg
print password from stdin message only to terminal
2025-02-16 18:29:34 +01:00
Michael Eischer 8c12291f56
Merge pull request #5241 from MichaelEischer/cleanup-cli
Refactor CLI command initialization to use less global state
2025-02-16 18:28:48 +01:00
Michael Eischer 5190933561
Merge pull request #5240 from MichaelEischer/better-json-docs
Improve JSON output type documentation
2025-02-16 18:28:29 +01:00
Michael Eischer 00e69f242e docs: fix datatypes 2025-02-16 18:17:22 +01:00
Michael Eischer 0c4e65228a refactor secondary options 2025-02-07 21:29:33 +01:00
Michael Eischer 120bd08c0d move globalOptions initialization into method 2025-02-07 21:29:33 +01:00
Michael Eischer d378a171c8 cleanup backend initialization 2025-02-07 21:29:33 +01:00
Michael Eischer c752867f0a fix linter errors 2025-02-07 21:29:33 +01:00
Michael Eischer 412d6d9ec5 Create root command via function 2025-02-07 21:29:33 +01:00
Michael Eischer 5497217018 print password from stdin message only to terminal 2025-02-07 20:54:18 +01:00
Michael Eischer aa9cdf93cf refactor persistent options to be applied via functions 2025-02-07 19:03:46 +01:00
Michael Eischer aacd6a47e3 refactor to use constructor functions to create cobra commands
This allows getting rid of the global options variables
2025-02-07 18:56:45 +01:00
Michael Eischer dc9b6378f3 move cli flags into AddFlags on option structs 2025-02-06 22:10:41 +01:00
Michael Eischer 4e58902de6 doc: fix broken links 2025-02-06 20:59:36 +01:00
Michael Eischer 39823c5f6c doc: deprecate short_id and add some missing fields 2025-02-06 20:53:01 +01:00
Michael Eischer 421842f41f doc: add datatypes to JSON outputs 2025-02-06 20:10:42 +01:00
Michael Eischer 59b7007534 doc: reformat scripting tables 2025-02-06 19:46:41 +01:00
Michael Eischer da47967316
Merge pull request #5194 from darkdragon-001/json-check
Json check
2025-02-05 22:15:10 +01:00
Dark Dragon 49a411f7ac Print JSON summary in all error cases 2025-02-05 22:08:06 +01:00
Dark Dragon 7cc1aa0cd4 Add check summary 2025-02-05 22:08:06 +01:00
Dark Dragon a58a8f2ce0 Add JSON output to check command 2025-02-05 22:08:05 +01:00
Dark Dragon 79d435efb1 Use printer.NewCounter() instead of newTerminalProgressMax()
where possible (max is unknown).
2025-02-05 22:07:47 +01:00
Michael Eischer 9cdf91b406
Merge pull request #5235 from MichaelEischer/refactor-ls-sorting
Refactor ls sorting
2025-02-05 20:44:08 +01:00
Winfried Plappert 4104a8e6a5
Issue: 4942: cmd_rewrite: add snapshot summary data to an existing snapshot. (#5185)
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2025-02-05 20:40:20 +01:00
Michael Eischer 6cc06e0812 ls: add missing error handling 2025-02-03 22:15:59 +01:00
Michael Eischer c32613a624 ls: extract comparator 2025-02-03 22:15:59 +01:00
Michael Eischer 1807627dda ls: refactor sorting into sortedPrinter struct 2025-02-03 22:15:59 +01:00
Michael Eischer 993eb112cd ls: deduplicate sorting test 2025-02-03 22:15:54 +01:00
Michael Eischer 36d8916354 ls: use numeric based enum for SortMode 2025-02-03 22:11:46 +01:00
Winfried Plappert 060a44202f
ls: sort output by size, atime, ctime, mtime, time(=mtime), extension (#5182)
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>
2025-02-03 22:07:04 +01:00