Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor repair index / prune into the repository package #4763

Merged
merged 20 commits into from
Apr 22, 2024

Conversation

MichaelEischer
Copy link
Member

What does this PR change? What problem does it solve?

Refactor repair index / prune loginc into the repository package.

The forget/prune/repair index commands now use the ui/printer interface for their progress output. Prune remains split into two functions PlanPrune which create a PrunePlan which provides an Execute() method to perform the actual prune.

The changes are accompanied with several testing cleanups and additional basic tests for the moved repair index / prune code.

In addition, repair index / prune now drop the then outdated in-memory index after the commands complete. This primarily serves to simplify testing and has no relevance for normal command executions.

Was the change previously discussed in an issue or on the forum?

Part of the refactoring for restic 0.17.0

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • [ ] I have added documentation for relevant changes (in the manual).
  • [ ] There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

This simplifies refactoring prune into the repository package.
The operation will always fail with an error if an index cannot be
deleted. Thus, this change is purely cosmetic.
The current in-memory index becomes stale after prune or repair index
have run. Thus, just drop the in-memory index altogether once these
commands have finished.
Copy link
Member Author

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@MichaelEischer MichaelEischer merged commit b15d867 into restic:master Apr 22, 2024
13 checks passed
@MichaelEischer MichaelEischer deleted the refactor-prune branch April 22, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

1 participant